Monday 17 December 2012

Selenium Actions 1

addSelection ( locator,optionLocator )
Add a selection to the set of selected options in a multi-select element using an option locator. @see #doSelect for details of option locatorsArguments:
  • locator - an element locator identifying a multi-select box
  • optionLocator - an option locator (a label by default)

answerOnNextPrompt ( answer )
Instructs Selenium to return the specified answer string in response to the next JavaScript prompt [window.prompt()].Arguments:
  • answer - the answer to give in response to the prompt pop-up

check ( locator )
Check a toggle-button (checkbox/radio)Arguments:

chooseCancelOnNextConfirmation ( )
By default, Selenium's overridden window.confirm() function will return true, as if the user had manually clicked OK. After running this command, the next call to confirm() will return false, as if the user had clicked Cancel.

click ( locator )
Clicks on a link, button, checkbox or radio button. If the click action causes a new page to load (like a link usually does), call waitForPageToLoad.Arguments:
  • locator - an element locator

clickAt ( locator,coordString )
Clicks on a link, button, checkbox or radio button. If the click action causes a new page to load (like a link usually does), call waitForPageToLoad. 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:
  • locator - an element locator
  • coordString - specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.

close ( )
Simulates the user clicking the "close" button in the titlebar of a popup window or tab.

createCookie ( nameValuePair,optionsString )
Create a new cookie whose path and domain are same with those of current page under test, unless you specified a path for this cookie explicitly.Arguments:
  • nameValuePair - name and value of the cookie in a format "name=value"
  • optionsString - options for the cookie. Currently supported options include 'path' and 'max_age'. the optionsString's format is "path=/path/, max_age=60". The order of options are irrelevant, the unit of the value of 'max_age' is second.

deleteCookie ( name,path )
Delete a named cookie with specified path.Arguments:
  • name - the name of the cookie to be deleted
  • path - the path property of the cookie to be deleted

dragdrop ( locator,movementsString )
Drags an element a certain distance and then drops it 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:
  • locator - an element locator
  • movementsString - offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"

fireEvent ( locator,eventName )
Explicitly simulate an event, to trigger the corresponding "onevent" handler.Arguments:
  • locator - an element locator
  • eventName - the event name, e.g. "focus" or "blur"

goBack ( )
Simulates the user clicking the "back" button on their browser.

keyDown ( locator,keySequence )
Simulates a user pressing a key (without releasing it yet).Arguments:
  • locator - an element locator
  • keySequence - Either be a string("\" followed by the numeric keycode of the key to be pressed, normally the ASCII value of that key), or a single character. For example: "w", "\119".

keyPress ( locator,keySequence )
Simulates a user pressing and releasing a key.Arguments:
  • locator - an element locator
  • keySequence - Either be a string("\" followed by the numeric keycode of the key to be pressed, normally the ASCII value of that key), or a single character. For example: "w", "\119".

keyUp ( locator,keySequence )
Simulates a user releasing a key.Arguments:
  • locator - an element locator
  • keySequence - Either be a string("\" followed by the numeric keycode of the key to be pressed, normally the ASCII value of that key), or a single character. For example: "w", "\119".

mouseDown ( locator )
Simulates a user pressing the mouse button (without releasing it yet) on the specified element.Arguments:

mouseDownAt ( locator,coordString )
Simulates a user pressing the mouse button (without releasing it yet) on the specified element. 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:
  • locator - an element locator
  • coordString - specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.

mouseMove ( locator )
Simulates a user pressing the mouse button (without releasing it yet) on the specified element.Arguments:

mouseMoveAt ( locator,coordString )
Simulates a user pressing the mouse button (without releasing it yet) on the specified element. 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:
  • locator - an element locator
  • coordString - specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.

mouseOut ( locator )
Simulates a user moving the mouse pointer away from the specified element.Arguments:

mouseOver ( locator )
Simulates a user hovering a mouse over the specified element.Arguments:

mouseUp ( locator )
Simulates a user pressing the mouse button (without releasing it yet) on the specified element.Arguments:

mouseUpAt ( locator,coordString )
Simulates a user pressing the mouse button (without releasing it yet) on the specified element. 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:
  • locator - an element locator
  • coordString - specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.

open ( url )
Opens an URL in the test frame. This accepts both relative and absolute URLs. The "open" command waits for the page to load before proceeding, ie. the "AndWait" suffix is implicit. Note: The URL must be on the same domain as the runner HTML due to security restrictions in the browser (Same Origin Policy). If you need to open an URL on another domain, use the Selenium Server to start a new browser session on that domain.Arguments:
  • url - the URL to open; may be relative or absolute

refresh ( )
Simulates the user clicking the "Refresh" button on their browser.

removeSelection ( locator,optionLocator )
Remove a selection from the set of selected options in a multi-select element using an option locator. @see #doSelect for details of option locatorsArguments:
  • locator - an element locator identifying a multi-select box
  • optionLocator - an option locator (a label by default)

No comments:

Post a Comment