Selenium IDE - Command to wait for 5 seconds

SeleniumSelenium Ide

Selenium Problem Overview


I´m using the Selenium IDE for Firefox and searching for a wait command. My problem is that I want to test a website with a embedded external map. This external map needs 3-5 seconds to load.

My commands:

open /Page/mysite.html
//Wait Command? (5 seconds)
ClickAndWait link=do something

Selenium Solutions


Solution 1 - Selenium

Use the pause command and enter the number of milliseconds in the Target field.

Set speed to fastest (Actions --> Fastest), otherwise it won't work.

Solution 2 - Selenium

This will delay things for 5 seconds:

Command: pause
Target: 5000
Value:

This will delay things for 3 seconds:

Command: pause
Target: 3000
Value:

Documentation:

http://release.seleniumhq.org/selenium-core/1.0/reference.html#pause

enter image description here enter image description here

Solution 3 - Selenium

For those working with ant, I use this to indicate a pause of 5 seconds:

<tr>
    <td>pause</td>
    <td>5000</td>
    <td></td>
</tr>

That is, target: 5000 and value empty. As the reference indicates:

> pause(waitTime) > > Arguments: > > - waitTime - the amount of time to sleep (in milliseconds) > > Wait for the specified amount of time (in milliseconds)

Solution 4 - Selenium

Your best bet is probably waitForCondition and writing a javascript function that returns true when the map is loaded.

Solution 5 - Selenium

This will do what you are looking for in C# (WebDriver/Selenium 2.0)

var browser = new FirefoxDriver();
var overallTimeout = Timespan.FromSeconds(10);
var sleepCycle = TimeSpan.FromMiliseconds(50);
var wait = new WebDriverWait(new SystemClock(), browser, overallTimeout, sleepCycle);
var hasTimedOut = wait.Until(_ => /* here goes code that looks for the map */);

And never use Thread.Sleep because it makes your tests unreliable

Solution 6 - Selenium

The pause command can be used directly in the ide in the html format.

If using java or C you could use Thread.sleep(5000). Time is in milliseconds. Other languages support "sleep 5" or time.sleep(5). you have multiple options for just waiting for a set time.

Solution 7 - Selenium

Before the command clickAndWait add the following code so the script will wait until the specific link to be visible:

   <tr>
    	<td>waitForVisible</td>
    	<td>link=do something</td>
    	<td></td>
    </tr>

The practice of using the wait commands instead of pause is most of the times more efficient and more stable.

Solution 8 - Selenium

This will wait until your link has appeared, and then you can click it.

Command: waitForElementPresent Target: link=do something Value:

Solution 9 - Selenium

One that I've found works for the site I test is this one:

waitForCondition | selenium.browserbot.getUserWindow().$.active==0 | 20000

Klendathu

Solution 10 - Selenium

In Chrome, For "Selenium IDE", I was also struggling that it doesn't pause. It will pause, if you give as below:

  • Command: pause
  • Target: blank
  • Value: 10000

This will pause for 10 seconds.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionLaPhiView Question on Stackoverflow
Solution 1 - SeleniumAdam PraxView Answer on Stackoverflow
Solution 2 - SeleniumMacGyverView Answer on Stackoverflow
Solution 3 - SeleniumfedorquiView Answer on Stackoverflow
Solution 4 - SeleniumhighlycaffeinatedView Answer on Stackoverflow
Solution 5 - SeleniumPawel PabichView Answer on Stackoverflow
Solution 6 - SeleniumrattlerbredView Answer on Stackoverflow
Solution 7 - SeleniumgeorgeView Answer on Stackoverflow
Solution 8 - Seleniumthe_average_averageView Answer on Stackoverflow
Solution 9 - SeleniumKlendathuView Answer on Stackoverflow
Solution 10 - SeleniumTechSinghView Answer on Stackoverflow