Monday 17 December 2012

Selenium Actions part 2

select ( selectLocator,optionLocator )
Select an option from a drop-down using an option locator. Option locators provide different ways of specifying options of an HTML Select element (e.g. for selecting a specific option, or for asserting that the selected option satisfies a specification). There are several forms of Select Option Locator.
label=labelPattern
matches options based on their labels, i.e. the visible text. (This is the default.)
  • label=regexp:^[Oo]ther
value=valuePattern
matches options based on their values.
  • value=other
id=id
matches options based on their ids.
  • id=option1
index=index
matches an option based on its index (offset from zero).
  • index=2
If no option locator prefix is provided, the default behaviour is to match on label.
Arguments:
  • selectLocator - an element locator identifying a drop-down menu
  • optionLocator - an option locator (a label by default)

selectFrame ( locator )
Selects a frame within the current window. (You may invoke this command multiple times to select nested frames.) To select the parent frame, use "relative=parent" as a locator; to select the top frame, use "relative=top". You may also use a DOM expression to identify the frame you want directly, like this: dom=frames["main"].frames["subframe"]
Arguments:

selectWindow ( windowID )
Selects a popup window; once a popup window has been selected, all commands go to that window. To select the main window again, use "null" as the target.Arguments:
  • windowID - the JavaScript window ID of the window to select

setContext ( context,logLevelThreshold )
Writes a message to the status bar and adds a note to the browser-side log. If logLevelThreshold is specified, set the threshold for logging to that level (debug, info, warn, error).
(Note that the browser-side logs will not be sent back to the server, and are invisible to the Client Driver.)
Arguments:
  • context - the message to be sent to the browser
  • logLevelThreshold - one of "debug", "info", "warn", "error", sets the threshold for browser-side logging

setCursorPosition ( locator,position )
Moves the text cursor to the specified position in the given input element or textarea. This method will fail if the specified element isn't an input element or textarea.Arguments:
  • locator - an element locator pointing to an input element or textarea
  • position - the numerical position of the cursor in the field; position should be 0 to move the position to the beginning of the field. You can also set the cursor to -1 to move it to the end of the field.

setTimeout ( timeout )
Specifies the amount of time that Selenium will wait for actions to complete. Actions that require waiting include "open" and the "waitFor*" actions.
The default timeout is 30 seconds.Arguments:
  • timeout - a timeout in milliseconds, after which the action will return with an error

submit ( formLocator )
Submit the specified form. This is particularly useful for forms without submit buttons, e.g. single-input "Search" forms.Arguments:

type ( locator,value )
Sets the value of an input field, as though you typed it in. Can also be used to set the value of combo boxes, check boxes, etc. In these cases, value should be the value of the option selected, not the visible text.
Arguments:

uncheck ( locator )
Uncheck a toggle-button (checkbox/radio)Arguments:

No comments:

Post a Comment