Professional Documents
Culture Documents
1. In a test that was created earlier, right-click on a step, for example, the
verify step.
2. The Selenium IDE context menu will be visible, as seen in the next
screenshot:
3. Click on the Insert New Comment. A space will appear between the
Selenium commands.
4. Click on the Command textbox and enter in a comment so that you can
use it for future maintenance. It will look similar to the next
screenshot:
Time for action – working with multiple windows
1. Open up the Selenium IDE and go to the Chapter1 page on the site.
2. 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.
3. Once the window has loaded, click on the Close the window text inside it.
4. Add a verify command for an element on the page. Your test should now
look similar to the next screenshot.
5. Click on the Close the window link.
6. Verify the element on the original window.
Time for action – switching between multiple windows
1. Start the Selenium IDE and go to Chapter1 on the website.
2. Click on the first link that
will launch a pop-up window.
3. Assert the text on the
page.
4. Go back to the parent
window and click on the link
to launch the second pop-up
window.
5. Verify the text on the
page.
6. Move to the first pop-up window and close it using the close link.
7. Move to the second pop-up window and close it using the close link.
8. Move back to the parent window and verify an element on that page.
9. Run your test and watch how it moves between the windows. When
complete, it should look similar to the next screenshot:
Target :
css=#ajaxdiv > p
Target :
//div[@id='ajaxdiv']/p
xpath=/html/body/div[2]/di
v[4]/input
Using element attributes in XPath queries
//input[@value='Sibling Button']/preceding-
sibling::input[@value='Button with ID']
[info] Executing: |open | / | |
[info] Executing: |clickAndWait | link=Chapter2 | |
[info] Executing: |verifyElementPresent | css=div.centerdiv | |
[info] Executing: |verifyElementPresent | css=div.leftdiv | |
[info] Executing: |open | / | |
[info] Executing: |clickAndWait | link=Chapter3 | |
[info] Executing: |click | link=exact:Index | |
[info] Executing: |open | / | |
[info] Executing: |clickAndWait | link=Chapter2 | |
[info] Executing: |click | link=exact:Index | |
2. Navigate to http://book.theautomatedtester.co.uk/chapter3.
3. Using verifyTextPresent check that the star sign Virgo is on the page.
4. Run your test.
[info] Executing: |open | / | |
[info] Executing: |clickAndWait | link=Chapter3 | |
[info] Executing: |verifyTextPresent | Virgo | |
[info] Executing: |verifyTextPresent | Guide | |
[info] Executing: |open | / | |
[info] Executing: |clickAndWait | link=Chapter2 | |
[info] Executing: |verifyTextPresent | loaded | |
[info] Executing: |open | / | |
Time for action – using basic regular expressions to check the date
http://regexpal.com/