How do I switch between two browser windows?
I have a script where I need to switch back to the previously opened browser window and perform some actions using TestComplete. I tried using the SetFocus() and Focus() method to activate a particular window. But it is not working.
I have been searching for information on the most proficient method to do this, yet I'm learning as I go, and I've invested excessively energy attempting to assemble this test. I trust this is a moderately basic kind of test that others have composed previously. Would someone be able to provide me the most ideal approach to this test? Any kind of help would be highly appreciated. Thanks in advance.
Usually, for web testing with TestComplete, you should work with Page object that is a child of the browser process but not with browser windows.
With this in mind, just refer to the required Page and it should be activated by TestComplete itself.
var page1 = Aliases.browser.Page('www.example.com/AdministerUsers/*');
// some link/button was clicked that opens new page
var page2 = Aliases.browser.Page('www.example.com/CommonUsersArea/*');
// do something within page2
// switch back to page1
page1.Button('Create new user').Click();