Monday 17 December 2012

Selenium Wait commands

waitForCondition ( script,timeout )
Runs the specified JavaScript snippet repeatedly until it evaluates to "true". The snippet may have multiple lines, but only the result of the last line will be considered. Note that, by default, the snippet will be run in the runner's test window, not in the window of your application. To get the window of your application, you can use the JavaScript snippet selenium.browserbot.getCurrentWindow(), and then run your JavaScript in there
Arguments:
  • script - the JavaScript snippet to run
  • timeout - a timeout in milliseconds, after which this command will return with an error

waitForPageToLoad ( timeout )
Waits for a new page to load. You can use this command instead of the "AndWait" suffixes, "clickAndWait", "selectAndWait", "typeAndWait" etc. (which are only available in the JS API).
Selenium constantly keeps track of new pages loading, and sets a "newPageLoaded" flag when it first notices a page load. Running any other Selenium command after turns the flag to false. Hence, if you want to wait for a page to load, you must wait immediately after a Selenium command that caused a page-load.
Arguments:
  • timeout - a timeout in milliseconds, after which this command will return with an error

waitForPopUp ( windowID,timeout )
Waits for a popup window to appear and load up.Arguments:
  • windowID - the JavaScript window ID of the window that will appear
  • timeout - a timeout in milliseconds, after which the action will return with an error

windowFocus ( windowName )
Gives focus to a windowArguments:
  • windowName - name of the window to be given focus

windowMaximize ( windowName )
Resize window to take up the entire screenArguments:
  • windowName - name of the window to be enlarged

No comments:

Post a Comment