Monday, 17 December 2012

Selenium Accessors part 4

storeConfirmation ( variableName )
Retrieves the message of a JavaScript confirmation dialog generated during the previous action. By default, the confirm function will return true, having the same effect as manually clicking OK. This can be changed by prior execution of the chooseCancelOnNextConfirmation command. If an confirmation is generated but you do not get/verify it, the next Selenium action will fail.
NOTE: under Selenium, JavaScript confirmations will NOT pop up a visible dialog.
NOTE: Selenium does NOT support JavaScript confirmations that are generated in a page's onload() event handler. In this case a visible dialog WILL be generated and Selenium will hang until you manually click OK.
Returns:
the message of the most recent JavaScript confirmation dialog
Related Assertions, automatically generated:

storeCookie ( variableName )
Return all cookies of the current page under test.
Returns:
all cookies of the current page under test
Related Assertions, automatically generated:

storeCursorPosition ( locator, variableName )
Retrieves the text cursor position in the given input element or textarea; beware, this may not work perfectly on all browsers. Specifically, if the cursor/selection has been cleared by JavaScript, this command will tend to return the position of the last location of the cursor, even though the cursor is now gone from the page. This is filed as SEL-243.
This method will fail if the specified element isn't an input element or textarea, or there is no cursor in the element.Arguments:
  • locator - an element locator pointing to an input element or textarea
  • variableName - the name of a variable in which the result is to be stored.
Returns:
the numerical position of the cursor in the field
Related Assertions, automatically generated:
  • assertCursorPosition ( locator, pattern )
  • assertNotCursorPosition ( locator, pattern )
  • verifyCursorPosition ( locator, pattern )
  • verifyNotCursorPosition ( locator, pattern )
  • waitForCursorPosition ( locator, pattern )
  • waitForNotCursorPosition ( locator, pattern )

storeElementHeight ( locator, variableName )
Retrieves the height of an elementArguments:
  • locator - an element locator pointing to an element
  • variableName - the name of a variable in which the result is to be stored.
Returns:
height of an element in pixels
Related Assertions, automatically generated:
  • assertElementHeight ( locator, pattern )
  • assertNotElementHeight ( locator, pattern )
  • verifyElementHeight ( locator, pattern )
  • verifyNotElementHeight ( locator, pattern )
  • waitForElementHeight ( locator, pattern )
  • waitForNotElementHeight ( locator, pattern )

storeElementIndex ( locator, variableName )
Get the relative index of an element to its parent (starting from 0). The comment node and empty text node will be ignored.Arguments:
  • locator - an element locator pointing to an element
  • variableName - the name of a variable in which the result is to be stored.
Returns:
of relative index of the element to its parent (starting from 0)
Related Assertions, automatically generated:
  • assertElementIndex ( locator, pattern )
  • assertNotElementIndex ( locator, pattern )
  • verifyElementIndex ( locator, pattern )
  • verifyNotElementIndex ( locator, pattern )
  • waitForElementIndex ( locator, pattern )
  • waitForNotElementIndex ( locator, pattern )

storeElementPositionLeft ( locator, variableName )
Retrieves the horizontal position of an elementArguments:
  • locator - an element locator pointing to an element OR an element itself
  • variableName - the name of a variable in which the result is to be stored.
Returns:
of pixels from the edge of the frame.
Related Assertions, automatically generated:
  • assertElementPositionLeft ( locator, pattern )
  • assertNotElementPositionLeft ( locator, pattern )
  • verifyElementPositionLeft ( locator, pattern )
  • verifyNotElementPositionLeft ( locator, pattern )
  • waitForElementPositionLeft ( locator, pattern )
  • waitForNotElementPositionLeft ( locator, pattern )

storeElementPositionTop ( locator, variableName )
Retrieves the vertical position of an elementArguments:
  • locator - an element locator pointing to an element OR an element itself
  • variableName - the name of a variable in which the result is to be stored.
Returns:
of pixels from the edge of the frame.
Related Assertions, automatically generated:
  • assertElementPositionTop ( locator, pattern )
  • assertNotElementPositionTop ( locator, pattern )
  • verifyElementPositionTop ( locator, pattern )
  • verifyNotElementPositionTop ( locator, pattern )
  • waitForElementPositionTop ( locator, pattern )
  • waitForNotElementPositionTop ( locator, pattern )

storeElementWidth ( locator, variableName )
Retrieves the width of an elementArguments:
  • locator - an element locator pointing to an element
  • variableName - the name of a variable in which the result is to be stored.
Returns:
width of an element in pixels
Related Assertions, automatically generated:
  • assertElementWidth ( locator, pattern )
  • assertNotElementWidth ( locator, pattern )
  • verifyElementWidth ( locator, pattern )
  • verifyNotElementWidth ( locator, pattern )
  • waitForElementWidth ( locator, pattern )
  • waitForNotElementWidth ( locator, pattern )

storeEval ( script, variableName )
Gets the result of evaluating the specified JavaScript snippet. The snippet may have multiple lines, but only the result of the last line will be returned. Note that, by default, the snippet will run in the context of the "selenium" object itself, so this will refer to the Selenium object, and window will refer to the top-level runner test window, not the window of your application.
If you need a reference to the window of your application, you can refer to this.browserbot.getCurrentWindow() and if you need to use a locator to refer to a single element in your application page, you can use this.page().findElement("foo") where "foo" is your locator.
Arguments:
  • script - the JavaScript snippet to run
  • variableName - the name of a variable in which the result is to be stored.
Returns:
the results of evaluating the snippet
Related Assertions, automatically generated:

storeExpression ( expression, variableName )
Returns the specified expression. This is useful because of JavaScript preprocessing. It is used to generate commands like assertExpression and waitForExpression.
Arguments:
  • expression - the value to return
  • variableName - the name of a variable in which the result is to be stored.
Returns:
the value passed in
Related Assertions, automatically generated:
  • assertExpression ( expression, pattern )
  • assertNotExpression ( expression, pattern )
  • verifyExpression ( expression, pattern )
  • verifyNotExpression ( expression, pattern )
  • waitForExpression ( expression, pattern )
  • waitForNotExpression ( expression, pattern )

No comments:

Post a Comment