Working with multiple browser windows can be one of the most difficult things to do within a Selenium Test. This is down to the fact that the browser needs to allow Selenium to programmatically know how many child browser processes have been spawned.
In the following examples we shall see the tests click on an element on the page which will cause a new window to appear. If you have a pop-up blocker running, it may be a good idea to disable it for this site while you work through these examples.
Open up Selenium IDE and go to the Chapter(Getting Started with Selenium IDE) page on the site.
Click on one of the elements on the page that has the text Click this link to launch another window. This will cause a small window to appear.
Verify the text in the popup by right-clicking and selecting Verify Text id=popup text within the popup window.
Once the window has loaded, click on the Close the Window text inside it.
Add a verify command for an element on the page. Your test should now look like the following screen shot:
Sometimes Selenium IDE will add a click And Wait instead of a click command.This is because it notices that the page has to unload. If this happens just change the click And Wait to a click so that it does not cause a timeout in the test.
What just happened?
In the test script we can see that it has clicked on the item to load the new window and then has inserted a wait For PopUp. This is so that your test knows that it has to wait for a web server to handle the request and the browser to render the page. Any commands that require a page to load from a web server will have a wait For command.
The next command is the select Window command. This command tells Selenium IDE that it will need to switch context to the window, called popup window, and will execute all the commands that follow in that window unless told otherwise by a later command.
Once the test has finished with the popup window, it will need to return to the parent window from where it started. To do this we need to specify null as the window. This will force the select Window to move the context of the test back to its parent window.
Selenium Related Interview Questions
|SILK TEST Interview Questions||QTP Interview Questions|
|JMeter Interview Questions||Automation Testing Interview Questions|
|Software testing Interview Questions||JUnit Interview Questions|
|TestNG Interview Questions||SAP Testing Interview Questions|
|Selenium WebDriver Interview Questions||Selenium IDE Interview Questions|
|QUnit Testing Interview Questions||Performance Testing Interview Questions|
|Hadoop Testing Interview Questions|
Getting Started With Selenium Ide
Overview Of Selenium Webdriver
Working With Webdriver
Getting Started With Selenium Grid
Advanced User Interactions
Working With Html5
Migrating From Remote Control To Webdriver
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.