Forum Discussion
lol
Of course. The two I don't use! :smileylol:
Have you tried using "Activate" rather than "SetFocus"? (Assuming they support this method ...)
I found SetFocus didn't work for me. Hence my use of Activate instead.
Hi,
Activate() and SetFocus() are different things. SetFocus() just sets the keyboard input focus to the given control while Activate() makes the window active and puts it in the front of all other windows. The above means that: a) Not all windows can be activated (e.g. MDI ones usually cannot); and b) the OnUnexpectedWindow() event is triggered if the given window cannot be activated (e.g. if it is blocked by some modal window). Note, that the OnUnexpectedWindow() event is not triggered if SetFocus fails to set the focus to the target control. The above makes it a standard coding practice (for desktop applications) to call Activate() at the proper places to ensure that no modal (usually - error or warning) windows are displayed.
The function from http://community.smartbear.com/t5/Functional-Web-Testing/How-to-match-a-Page-object-to-its-BrowserWindow/m-p/85701#M19988 worked fine for me for all windows-supported browsers (except Edge which I just did not check). However the referenced function relies on the caption of the target window...
Related Content
Recent Discussions
- 9 hours agodhundley