Tuesday, December 10, 2013

Selenium:Selenium Accessors

Selenium Accessors

assertSelected ( selectLocator,optionLocator )

Verifies that the selected option of a drop-down satisfies the optionSpecifier. Note that this command is deprecated; you should use assertSelectedLabel, assertSelectedValue, assertSelectedIndex, or assertSelectedId instead.
See the select command for more information about option locators.
Arguments:
·         selectLocator - an element locator identifying a drop-down menu
·         optionLocator - an option locator, typically just an option label (e.g. "John Smith")
Related Assertions, automatically generated:
·         assertNotSelected ( selectLocator, optionLocator )
·         verifySelected ( selectLocator, optionLocator )
·         verifyNotSelected ( selectLocator, optionLocator )
·         waitForSelected ( selectLocator, optionLocator )
·         waitForNotSelected ( selectLocator, optionLocator )

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:
·         assertAlert ( pattern )
·         assertNotAlert ( pattern )
·         verifyAlert ( pattern )
·         verifyNotAlert ( pattern )
·         waitForAlert ( pattern )
·         waitForNotAlert ( pattern )

storeAttribute ( attributeLocator, variableName )

Gets the value of an element attribute.
Arguments:
·         attributeLocator - an element locator followed by an @ sign and then the name of the attribute, e.g. "foo@bar"
·         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 )

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:
·         assertConfirmation ( pattern )
·         assertNotConfirmation ( pattern )
·         verifyConfirmation ( pattern )
·         verifyNotConfirmation ( pattern )
·         waitForConfirmation ( pattern )
·         waitForNotConfirmation ( pattern )

storeSelectedIds ( selectLocator, variableName )

Gets all option element IDs for selected options in the specified select or multi-select element.
Arguments:
·         selectLocator - an element locator identifying a drop-down menu
·         variableName - the name of a variable in which the result is to be stored.
Returns:
an array of all selected option IDs in the specified select drop-down
Related Assertions, automatically generated:
·         assertSelectedIds ( selectLocator, pattern )
·         assertNotSelectedIds ( selectLocator, pattern )
·         verifySelectedIds ( selectLocator, pattern )
·         verifyNotSelectedIds ( selectLocator, pattern )
·         waitForSelectedIds ( selectLocator, pattern )
·         waitForNotSelectedIds ( selectLocator, pattern )

 

storeSelectedIndex ( selectLocator, variableName )

Gets option index (option number, starting at 0) for selected option in the specified select element.
Arguments:
·         selectLocator - an element locator identifying a drop-down menu
·         variableName - the name of a variable in which the result is to be stored.
Returns:
the selected option index in the specified select drop-down
Related Assertions, automatically generated:
·         assertSelectedIndex ( selectLocator, pattern )
·         assertNotSelectedIndex ( selectLocator, pattern )
·         verifySelectedIndex ( selectLocator, pattern )
·         verifyNotSelectedIndex ( selectLocator, pattern )
·         waitForSelectedIndex ( selectLocator, pattern )
·         waitForNotSelectedIndex ( selectLocator, pattern )

storeText ( locator, variableName )

Gets the text of an element. This works for any element that contains text. This command uses either the textContent (Mozilla-like browsers) or the innerText (IE-like browsers) of the element, which is the rendered text shown to the user.
Arguments:
·         locator - an element locator
·         variableName - the name of a variable in which the result is to be stored.
Returns:
the text of the element
Related Assertions, automatically generated:
·         assertText ( locator, pattern )
·         assertNotText ( locator, pattern )
·         verifyText ( locator, pattern )
·         verifyNotText ( locator, pattern )
·         waitForText ( locator, pattern )
·         waitForNotText ( locator, pattern )

storeTitle ( variableName )

Gets the title of the current page.
Returns:
the title of the current page
Related Assertions, automatically generated:
·         assertTitle ( pattern )
·         assertNotTitle ( pattern )
·         verifyTitle ( pattern )
·         verifyNotTitle ( pattern )
·         waitForTitle ( pattern )
·         waitForNotTitle ( pattern )

storeValue ( locator, variableName )

Gets the (whitespace-trimmed) value of an input field (or anything else with a value parameter). For checkbox/radio elements, the value will be "on" or "off" depending on whether the element is checked or not.
Arguments:
·         locator - an element locator
·         variableName - the name of a variable in which the result is to be stored.
Returns:
the element value, or "on/off" for checkbox/radio elements
Related Assertions, automatically generated:
·         assertValue ( locator, pattern )
·         assertNotValue ( locator, pattern )
·         verifyValue ( locator, pattern )
·         verifyNotValue ( locator, pattern )
·         waitForValue ( locator, pattern )
·         waitForNotValue ( locator, pattern )

storeChecked ( locator, variableName )

Gets whether a toggle-button (checkbox/radio) is checked. Fails if the specified element doesn't exist or isn't a toggle-button.
Arguments:
·         locator - an element locator pointing to a checkbox or radio button
·         variableName - the name of a variable in which the result is to be stored.
Returns:
true if the checkbox is checked, false otherwise
Related Assertions, automatically generated:
·         assertChecked ( locator )
·         assertNotChecked ( locator )
·         verifyChecked ( locator )
·         verifyNotChecked ( locator )
·         waitForChecked ( locator )
·         waitForNotChecked ( locator )

storeEditable ( locator, variableName )

Determines whether the specified input element is editable, ie hasn't been disabled. This method will fail if the specified element isn't an input element.
Arguments:
·         locator - an element locator
·         variableName - the name of a variable in which the result is to be stored.
Returns:
true if the input element is editable, false otherwise
Related Assertions, automatically generated:
·         assertEditable ( locator )
·         assertNotEditable ( locator )
·         verifyEditable ( locator )
·         verifyNotEditable ( locator )
·         waitForEditable ( locator )
·         waitForNotEditable ( locator )


No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...