In our first example, we are going to click on a link and then assert some text is visible on the screen:
Start up Selenium IDE and make sure that the Record button is pressed.
Navigate to http://www.wisdomjobs.com.
Click on the text that says Click this link to load a page with AJAX.
Verify the text that appears on your screen.Your test should look like the following screen shot:
Run the test that you have created. When it has finished running it should look like the following screen shot:
Have a look at the page that you are working against. Can you see the text that the test is expecting? You should see it, so why has this test failed? The test has failed because when the test reached that point, the element containing the text was not loaded into the DOM. This is because it was being requested and rendered from the web server into the browser.
To remedy this issue, we will need to add a new command to our test so that our tests pass in the future:
Right-click on the step that failed so the Selenium IDE context menu appears.
Click on Insert New Command.
In the Command select box, type wait For Element Present or select it from the drop down menu.
In the Target box add the target that is used in the verify Text command.
Run the test again and it should pass this time:
What just happened?
Selenium does not implicitly wait for the item that it needs to interact with, so it is seen as good practice to wait for the item you need to work with then interact with it. The wait For commands will timeout after 30 seconds by default but if you need it to wait longer you can specify the tests by using the set Timeout command. This will set the timeout value that the tests will use in future commands.
If need be you can change the default wait if you go to Options | Optionsand then on theGeneral tab and under Default timeout value of recorded command in milli seconds (30s = 30000ms) change it to what you want.Remember that there are 1000 milliseconds in a second.
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|
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.