Sometimes, a user may need to switch between different tabs or windows in a single session to complete tasks or perform a few steps while testing Application under Test (AUT). In order to perform any activity across pages, the user has to switch the control to the desired window/tab first and then perform action on it. This can be tackled in Qualitia using two different actions; StoreWindowHandle and SelectPage.
The window handle is a unique hexadecimal ID of the page being used to perform web application testing. Qualitia provides provision to store and use these IDs as per the requirements to switch between multiple pages of the AUT.
The use case below shows how you can switch between multiple pages/tabs using Qualitia actions.
- Application under Test: https://www.google.co.in.
- Workflow: Open the home page of Google, press F1 to open the help page and then switch between the two open tabs (Help and Google Home Page).
In order to perform this workflow, add steps as shown below.
Action | Parameters | Description |
---|---|---|
OpenURL | “https://google.co.in” | Opens Google home page. |
StoreWindowHandle | “Page1” | Stores the window handle (a unique page ID) of Google home page under the key name “Page1”. |
PressKeys | “~{F1~}” | Stimulates F1 key and opens the help page. |
StoreWindowHandle | “Page2” | Stores the window handle of the Help page under the key name “Page2”. |
SelectPage | “{Page2}” | Selects the page whose ID we have given in the parameter section to perform further actions. |
PressKeys | “~{Ctrl+W~}” | Stimulates (Ctrl+W) key and closes the help page. |
The mechanism of StoreWindowHandle works as shown above, where you have to store Handles for every single window the application is opening into, even if you desire to switch to nth window.
This way you can switch between as many pages as you want as per the test case requirements. You just have to use the correct key to navigate to the respective page, then select objects from that page to perform steps.