SUBSCRIBE HERE TO GET POST UPDATES VIA EMAIL :

Delivered by FeedBurner

How to Use Selenium IDE "waitForText" and "waitForNotText" commands?

"waitFor" commands of selenium IDE are very useful for your software application regression testing. There are many waitFor commands avaailable in selenium IDE like - "waitForElementPresent " command will pause selenium until targeted element not present on software web application page,
 "waitForPageToLoad" command will force selenium to pause until page not get loaded properly. Same way, "waitForText" and "waitForNotText" commands are works with text of software application web page. Let me describe both of them.

"waitForText" Command
"waitForText" will wait for the text to be present on targeted element. It will pause selenium until expected text not present on targeted element. Once targeted element gets expected text, selenium IDE execution will be resumed.

"waitForNotText" Command
Opposite to "waitForText" Command, "waitForNotText" Command will wait for specified text to be not present on targeted element. Once text from targeted element disappeared, next command will be executed.

Let we take simple example for both the commands.

New Test
CommandTargetValue
openhttp://only-testing-blog.blogspot.in/2013/09/test.html
waitForNotTextcss=#timeLeftTime left:*
clickAndWaitcss=#submitButton
waitForTextcss=#timeLeftReady!
clickAndWaitcss=#submitButton

View waitForText Example In WebDriver

Look in to above example, "waitForNotText" command will wait for text 'Time left:*'(We can use * at the beginning or in between or at the end of sentence if string value is dynamic.) to disappear from targeted element. Once that text disappear, selenium will execute next command. Same way, "waitForText" command will wait for text 'Ready!' to be present on targeted element.

First run above example in selenium IDE and then create same test case for your software web application.

No comments:

Post a Comment