Selenium Accessors part 3
- 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
Selenium Accessors
-
storeAlert
(
variableName
)
- Retrieves the message of a JavaScript alert generated during the previous action, or fail if there were no alerts.
Getting an alert has the same effect as manually clicking OK. If an
alert is generated but you do not get/verify it, the next Selenium action
will fail.
NOTE: under Selenium, JavaScript alerts will NOT pop up a visible alert
dialog.
NOTE: Selenium does NOT support JavaScript alerts that are generated in a
page's onload() event handler. In this case a visible dialog WILL be
generated and Selenium will hang until someone manually clicks OK.
- Returns:
- The message of the most recent JavaScript alert
Related Assertions, automatically generated:
-
storeAllButtons
(
variableName
)
- Returns the IDs of all buttons on the page.
If a given button has no ID, it will appear as "" in this array.
- Returns:
- the IDs of all buttons on the page
Related Assertions, automatically generated:
-
storeAllFields
(
variableName
)
- Returns the IDs of all input fields on the page.
If a given field has no ID, it will appear as "" in this array.
- Returns:
- the IDs of all field on the page
Related Assertions, automatically generated:
-
storeAllLinks
(
variableName
)
- Returns the IDs of all links on the page.
If a given link has no ID, it will appear as "" in this array.
- Returns:
- the IDs of all links on the page
Related Assertions, automatically generated:
-
storeAllWindowIds
(
variableName
)
- Returns the IDs of all windows that the browser knows about.
- Returns:
- the IDs of all windows that the browser knows about.
Related Assertions, automatically generated:
-
storeAllWindowNames
(
variableName
)
- Returns the names of all windows that the browser knows about.
- Returns:
- the names of all windows that the browser knows about.
Related Assertions, automatically generated:
-
storeAllWindowTitles
(
variableName
)
- Returns the titles of all windows that the browser knows about.
- Returns:
- the titles of all windows that the browser knows about.
Related Assertions, automatically generated:
- assertAllWindowTitles
(
pattern
)
- assertNotAllWindowTitles
(
pattern
)
- verifyAllWindowTitles
(
pattern
)
- verifyNotAllWindowTitles
(
pattern
)
- waitForAllWindowTitles
(
pattern
)
- waitForNotAllWindowTitles
(
pattern
)
-
storeAttribute
(
attributeLocator,
variableName
)
- Gets the value of an element attribute.
Beware of http://jira.openqa.org/browse/SEL-280, which will lead some event handlers to
get null event arguments. Read the bug for more details, including a workaround.Arguments:
- attributeLocator - an element locator followed by an
- variableName -
the name of a variable in which the result is to be stored.
- Returns:
- the value of the specified attribute
Related Assertions, automatically generated:
- assertAttribute
(
attributeLocator, pattern
)
- assertNotAttribute
(
attributeLocator, pattern
)
- verifyAttribute
(
attributeLocator, pattern
)
- verifyNotAttribute
(
attributeLocator, pattern
)
- waitForAttribute
(
attributeLocator, pattern
)
- waitForNotAttribute
(
attributeLocator, pattern
)
-
storeAttributeFromAllWindows
(
attributeName,
variableName
)
- Returns every instance of some attribute from all known windows.Arguments:
- attributeName - name of an attribute on the windows
- variableName -
the name of a variable in which the result is to be stored.
- Returns:
- the set of values of this attribute from all known windows.
Related Assertions, automatically generated:
- assertAttributeFromAllWindows
(
attributeName, pattern
)
- assertNotAttributeFromAllWindows
(
attributeName, pattern
)
- verifyAttributeFromAllWindows
(
attributeName, pattern
)
- verifyNotAttributeFromAllWindows
(
attributeName, pattern
)
- waitForAttributeFromAllWindows
(
attributeName, pattern
)
- waitForNotAttributeFromAllWindows
(
attributeName, pattern
)
-
storeBodyText
(
variableName
)
- Gets the entire text of the page.
- Returns:
- the entire text of the page
Related Assertions, automatically generated:
No comments:
Post a Comment