Select Window (selectWindow)
Select Window API allows selecting a particular window before performing further actions.
Action API is 'Select Window' followed by window identifier, the window identifier can be the window name, the window title, or the window URL, regular expression of any of these.
To come back to the main or the base window, just omit the window identifier parameter and use only Select Window, which will select the main window.
Below is the usage and example in Test Designer:
4th step shows the use of Select Window API with a window name and all the steps below that will be executed on that window till the 9th step
The 11th step has a Select Window API without any accessors which means it will select the parent window and perform the steps further.
JavaScript Example
navigateTo("Southwest Airlines | Book Flights, Make Reservations & Plan a Trip ");
click(submit("swa-header-link--plan-a-trip"));
click(link("Book a Hotel"));
selectWindow("Southwest Airlines: 1,514,051 hotels worldwide. 133+ million hotel reviews.");
setSelected(select("group_adults"),"10");
setSelected(select("group_children"),"4");
setSelected(select("age[2]"),"11");
click(link("click here to browse more travel destinations"));
selectWindow("Southwest Airlines: Booking.com Online Hotel Reservations - List of Destinations");
click(link("Sweden"));
selectWindow();
click(link("Hotels"));