Forum Discussion
Hi,
As far as I can see from the screenshot, when TestComplete tries to set a focus to the combo box, the application handles this and sets the focus to the WinFormsObject("buttonFindLibItems") object. It is difficult to understand why this happens without the tested application. Could you please send us the application under test and the test project you are using via the Contact Support form?
Hi,
I am having the same issue now, the object got focus and the test is running fine but the error message says "Unable to find the object SetFocus. "
When using SetFocus() with window(code below), there is no error message.
Aliases.browser.BrowserWindow3.SetFocus();
Here is my code, I have tried the solution mentioned in this post. The delay doesn't work, and FullName is the name of the object that got focused. How do I disable the error message??
aqUtils.Delay (2000, "delay to click");
globalObjects.chooseAfile.SetFocus();
Log.Message(Sys.Desktop.FocusedWindow().FullName);
- tristaanogre7 years agoEsteemed Contributor
roytberA wrote:
Hi,
I am having the same issue now, the object got focus and the test is running fine but the error message says "Unable to find the object SetFocus. "
When using SetFocus() with window(code below), there is no error message.
Aliases.browser.BrowserWindow3.SetFocus();
Here is my code, I have tried the solution mentioned in this post. The delay doesn't work, and FullName is the name of the object that got focused. How do I disable the error message??
aqUtils.Delay (2000, "delay to click");
globalObjects.chooseAfile.SetFocus();
Log.Message(Sys.Desktop.FocusedWindow().FullName);Note that the OP is a different general source of the issue and is also 4 years old. There have been numerous updates to TestComplete since then as well as different ways of handling things. The original post is in a desktop application where as your situation seems to involve web applications.
I have a question concerning your post... you are trying to set focus on the browser window instead of some component or page within your web application. What are you intending to achieve? Please describe what you are trying to implement and any information such as application type (WEB vs Desktop), technologies used in the app, screenshots of the objects in question using Object Spy and/or object browser, etc.
- roytberA7 years agoOccasional Contributor
Hi Robert,
Thank you for your respond.
My question now is, does SetFocus method work with Window Object or only work with BrowserWindow? I tried using it with other objects on other page, and it also log error "unable to find the object SetFocus. Seems to me it only works with BrowserWindow... or I am doing something wrong here.
To answer your questions in italic...
What are you intending to achieve? I am trying to SetFocus on the objcet "Aliases.browser.pageConfirm.cellPopupm.table.cellNoticnconttablebx.table" which happens after another window get closed(a popup window for confirmation which get closed when click "OK"). By using "Aliases.browser.BrowserWindow3.SetFocus()" the window got focus, but when try to SetFocus on any object on that page, the error message say "Unable to find the object SetFocus. ". But really it was able to find and clicked, no issue. I don't know why there is error message there. If SetFocus is not use, object cannot be found.
Please describe what you are trying to implement and any information such as application type (WEB vs Desktop),
technologies used in the app, screenshots of the objects in question using Object Spy and/or object browser
- WEB application using IE.
Thanks again
- AlexKaras7 years agoChampion Level 3
Hi,
Usually, the "unable to find the object" JavaScript/JScript error means that the parent object (e.g. BrowserWindow3) was not identified by TestComplete. If TestComplete has not identified BrowserWindow3 object, then it (TestComplete) does not wrap it with helper functions (and SetFocus() is one of these functions). In this case TestComplete passes BrowserWindow3.SetFocus() expression to JavaScript/JScript runtime as is. JavaScript/JScript runtime tries to resolve SetFocus() according to its regular rules, fails (as such object cannot be resolved indeed) and posts runtime error.
So, on the first place, I would recommend to check in the debugger if BrowserWindow3 object was resolved by TestComplete. This can be done, for example, by checking if BrowserWindow3.Exists equals to true.
Another point that I remember (though it is from an old times and is desktop-application related) is that SetFocus() is applicable for the controls that can be focused (i.e. highlighted with the cursor put in the field).
Windows, on the other hand, could be activated (via BrowserWindow3.Activate() ), but not focused.
Related Content
Recent Discussions
Check PopupMenu exists
Solved3 days agomfoster711- 4 days agosimonaferrara
- 5 days agomacheshmeh