Waiting for elements to appear in your page is something we do pretty much everywhere in our tests, but the way you wait for them to do it can impact in the efficiency of your scripts in interesting ways.
Let’s analyze a test that has a step like the following:
| waitForElementPresent | css=h2:contains(‘Sauce Labs’) | 60000 |
This waits for the title “Sauce Labs” to appear, which will work as expected most of the times. But, what if you app fails and the title’s text loaded is incorrect? It will take the script to eat the whole 60 second timeout before noticing and reporting it.
Then, a much better approach to write this kind of waiting is:
| waitForElementPresent | css=h2.titles_class | 60000 |
| assertText | css=h2.titles_class | Sauce Labs |
It will now detect the title is loaded at the moment it does, no matter which content it has, and then move on to assert for it’s text.
As you can see, a simple change in your scripts like this one will make them both run faster and report errors more accurately.
Stay tuned, we’ll be bringing more tips to improve your Selenium tests every week.

Hello,
I have just started using Selenium IDE 1.0.7. I am also new at software testing. I have been a PowerBuilder programmer in my company for 5 years. I was asked to join the QA team and do testing on a new .NET application that is being built by a third party. For the last nine months I have been doing my testing manually. I am trying to find a tool that will automate my manual testing. I found Selenium IDE in the last week and have be somewhat successful in recording and playing back the test again, but I have not be able to overcome the default 30000ms timeout. I tried setting it in the Options tab. I have used the ‘setTimeout’ command and the ‘pause’ command, but none of these commands are working for me. I have one web page that takes 90 seconds to retrieve all the claim information for a employee. I need to set the default time to 100000ms so that I am assured that the data returns before I start filling out the new claim. I would appreciate any suggestion for coding this in the Selenium IDE. I saw on one blog that the default time of 30000ms cannot not be changed no matter what command you use. Is this true?
Thanks in advance for your help!
Bob Humphries
Email: bhumphries@fbmc.com
Phone: 850-893-3580
Hi Bob,
This kind of question should be addressed in our user forums instead of our blog, feel free to go there and ask for help from our experts.
Best,
Santi
[...] Selenium Tips: Improving your waiting skills [...]