Sie sind auf Seite 1von 9

Selenium Commands

The following commands are available to create scripts which can be run by our service. These are mainly Selenium commands but also include some custom commands for our service. The commands have either 0, 1 or 2 arguments, as indicated in the table. Name Open Arg1 url the URL to open; may be relative or absolute Assert Title Check the title of a web page. the title to check Click and Click on a link and wait for locator an element locator Wait the page to load Click Click on a link in the page. locator an element locator Type Type content into a entry box locator an element locator on the web page. Wait Wait for a number of seconds time time to wait in seconds Capture Capture a screenshot of the Screenshot current page. Add Selection Add a selection to the set of locator an element locator selected options in a multiidentifying a multi-select box select element using an option locator. Alt Key Press the alt key and hold it Down down until ALTKEYUP is called or a new page is loaded. Alt Key Up Release the alt key. Answer on Return the specified answer answer the answer to give in Next Prompt string in response to the next response to the prompt pop-up JavaScript prompt. Check Check a toggle-button locator an element locator (checkbox/radio). Click At Clicks on a link, button, locator an element locator checkbox or radio button. Description Open a URL. Arg2

value the value to type

optionLocator an option locator (a label by default)

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. Control Key Press the control key and hold

Name Down

Description Arg1 it down until doControlUp() is called or a new page is loaded. Control Key Release the control key. Up Double Click Double clicks on a link, locator an element locator button, checkbox or radio button. Double Click Doubleclicks on a link, button, locator an element locator At checkbox or radio button.

Arg2

Drag and Drop

Drags an element a certain distance and then drops it.

locator an element locator

Drag and Drop to Object

Drags an element and drops it locatorOfObjectToBeDragged an on another element. element to be dragged

Fire Event

Explicitly simulate an event, locator an element locator to trigger the corresponding onevent handler. Get Alert Retrieves the message of a JavaScript alert generated during the previous action, or fail if there were no alerts. Get Retrieves the message of a Confirmation JavaScript confirmation dialog generated during the previous action. Get Prompt Retrieves the message of a JavaScript question prompt dialog generated during the previous action. Go Back Simulates the user clicking the back button on their browser. Is Text Verifies that the specified text the text that should appear on the Present pattern appears somewhere on page

coordString specifies the x,y position (i.e. 10,20) of the mouse event relative to the element returned by the locator. movementsString offset in pixels from the current location to which the element should be moved, e.g., +70,-300 locatorOfDragDestinationObject an element whose location (i.e., whose center-most pixel) will be the point where locatorOfObjectToBeDragged is dropped eventName the event name, e.g. focus or blur

Name

Key Down

Description Arg1 the rendered page shown to the user. Simulates a user pressing a locator an element locator key (without releasing it yet).

Arg2

Key Press

Simulates a user pressing and locator an element locator releasing a key.

Key Up

Simulates a user releasing a key.

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. 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. 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.

Mouse Down Simulates a user pressing the mouse button (without releasing it yet) on the specified element. Mouse Down Simulates a user pressing the At mouse button (without releasing it yet) at the specified location. Mouse Move Simulates a user pressing and moving the mouse button (without releasing it yet) on the specified element. Mouse Move Simulates a user pressing and At moving the mouse button (without releasing it yet) on the specified element. Mouse Out Simulates a user moving the mouse pointer away from the specified element.

locator an element locator

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.

locator an element locator

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.

locator an element locator

Name Description Arg1 Mouse Over Simulates a user hovering a locator an element locator mouse over the specified element. Mouse Up Simulates the event that locator an element locator occurs when the user releases the mouse button (i.e., stops holding the button down) on the specified element. Mouse Up At Simulates the event that locator an element locator occurs when the user releases the mouse button (i.e., stops holding the button down) at the specified location. Open Opens a popup window (if a url the URL to open, which can be Window window with that ID isnt blank already open). Refresh Simulates the user clicking the Refresh button on their browser. Remove All Unselects all of the selected locator an element locator Selections options in a multi-select identifying a multi-select box element. Remove Remove a selection from the locator an element locator Selection set of selected options in a identifying a multi-select box multi-select element using an option locator. Select Select an option from a drop- locator an element locator down using an option locator. identifying a multi-select box Shift Key Press the shift key and hold it Down down until SHIFTKEYUP is called or a new page is loaded. Shift Key Up Release the shift key. Submit Submit the specified form. formLocator an element locator for the form you want to submit Type Keys Simulates keystroke events on locator an element locator the specified element, as though you typed the value key-by-key. Uncheck Uncheck a toggle-button locator an element locator (checkbox/radio) Append Append content to a entry box locator an element locator

Arg2

coordString specifies the x,y position (i.e. 10,20) of the mouse event relative to the element returned by the locator. windowID the JavaScript window ID of the window to select

optionLocator an option locator (a label by default)

optionLocator an option locator (a label by default)

value the value to type

value the content to append

Description Arg1 on the web page. The new content is added to the end of the existing content. Dummy A dummy command that does not do anything. Unsupported Commands that are not recognised when a script is uploaded, are mapped to this. Select Frame Selects a frame within the locator an element locator current window. identifying a frame or iframe Select Selects a popup window; once windowID the JavaScript window Window a popup window has been ID of the window to select selected, all commands go to that window. Window Gives focus to the currently Focus selected window Store Alert Stores the message of the most recent JavaScript alert. Cancel On Simulate the user clicking Next Cancel to the next Confirmation. OK On Next Undo the effect of calling Cancel On Next. Create Create a new cookie whose nameValuePair name and value of Cookie path and domain are same the cookie in a format name=value with those of current page under test, unless you specified a path for this cookie explicitly.

Name

Arg2

Delete Cookie Meta Key Down

Delete a named cookie with specified path. Press the meta key and hold it down until Meta Key Up command is called or a new page is loaded. Meta Key Up Release the meta key. Pause Wait for the specified amount waitTime the amount of time to of time (in milliseconds). sleep (in milliseconds). Set Cursor Moves the text cursor to the locator an element locator pointing position the numerical position

optionsString options for the cookie. Currently supported options include path and max_age. the optionsStrings format is path=/path/, max_age=60. The order of options are irrelevant, the unit of the value of max_age is second. name the name of the cookie to be path the path property of the deleted. cookie to be deleted.

Name Position

Set Mouse Speed

Set Speed

Wait For Frame To Load

Description specified position in the given input element or textarea. This method will fail if the specified element isnt an input element or textarea. Configure the number of pixels between mousemove events during dragAndDrop commands (default=10). Set execution speed (i.e., set the millisecond length of a delay which will follow each selenium operation). By default, there is no such delay, i.e., the delay is 0 milliseconds. Waits for a new frame to load.

Arg1 to an input element or textarea.

Arg2 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.

pixels the number of pixels between mousemove events.

value the number of milliseconds to pause after operation.

Wait For Waits for a new page to load. Page To Load Wait For PopUp Assert Text Present Assert Text Not Present Verify Text Present Waits for a popup window to appear and load up.

Asserts if the specified text IS NOT present on the page. Asserts if the specified text IS present on the page. Verifies that the specified text IS present if it is not, it is an error. Verify Text Verifies that the specified text the text that should NOT appear on Not Present IS NOT present if it is, it is the page an error. Assert Pattern Asserts that a pattern IS the pattern that should appear within present within the page source. the page source Assert No Asserts that a pattern IS NOT the pattern that should NOT appear Pattern present within the page source. within the page source Cloud Testing Internal Cloud Testing n/a n/a

frameAddress FrameAddress from timeout a timeout in the server side. milliseconds, after which this command will return with an error. timeout a timeout in milliseconds, after which this command will return with an error. windowID the JavaScript window timeout a timeout in ID of the window that will appear. milliseconds, after which the action will return with an error. the text that should appear on the page the text that should NOT appear on the page the text that should appear on the page

Name Description Arg1 Arg2 Internal Command DO NOT USE Command Assert Value Asserts that the value of the locator an element locator pointing the text or pattern that should specified input field matches to an input element appear in the input field the pattern specified. Assert Not Asserts that the value of the locator an element locator pointing the text or pattern that should Value specified input field DOES to an input element NOT appear in the input field NOT match the pattern specified. Verify Value Verifies that the value of the locator an element locator pointing the text or pattern that should specified input field matches to an input element appear in the input field the pattern specified. Verify Not Verifies that the value of the locator an element locator pointing the text or pattern that should Value specified input field DOES to an input element NOT appear in the input field NOT match the pattern specified. Assert Asserts that the toggle-button locator an element locator pointing Checked is checked. to a toggle-button. Assert Not Asserts that the toggle-button locator an element locator pointing Checked is NOT checked. to a toggle-button. Verify Verifies that the toggle-button locator an element locator pointing Checked is checked. to a toggle-button. Verify Not Verifies that the toggle-button locator an element locator pointing Checked is NOT checked. to a toggle-button. Assert Tex Asserts that the text is present locator an element locator pointing the text or pattern that should at the specific locator. to an element that contains text. appear Assert Not Asserts that the text is NOT locator an element locator pointing the text or pattern that should Text present at the specific locator. to an element that contains text. NOT appear Verify Text Verifies that the text is present locator an element locator pointing the text or pattern that should at the specific locator. to an element that contains text. appear Verify Not Verifies that the text is NOT locator an element locator pointing the text or pattern that should Text present at the specific locator. to an element that contains text. NOT appear Assert Alert Asserts that the value of the the pattern that should appear as the alert matches the pattern alert specified. Assert Alert Asserts if an alert is not Not Present present Assert Alert Asserts if an alert is present Present Store Alert Returns if an alert was present a dummy variable the value is NOT

Name Description Arg1 Present or not. stored into it Verify Alert Verifies that the value of the the pattern that should appear as the alert matches the pattern alert specified. Verify Alert Verifies that an alert IS NOT Not Present present. Verify Alert Verifies that an alert IS Present present. Wait For Waits for the alert matching the pattern that should appear as the Alert the pattern to appear. alert Wait For Waits for an alert not present Alert Not Present Wait For Waits for an alert to be present Alert Present Assert Asserts that the value of the the pattern that should appear as the Confirmation confirmation matches the confirmation. pattern specified. Assert Asserts if a confirmation is Confirmation NOT present. Not Present Assert Asserts if a confirmation is Confirmation present. Present Store Stores the message from the Confirmation most recent confirmation. Store Returns if an confirmation was a dummy variable the value is NOT Confirmation present or not. stored into it Present Verify Verifies that the value of the the pattern that should appear as the Confirmation confirmation matches the confirmation. pattern specified. Verify Verifies if a confirmation is Confirmation NOT present. Not Present Verify Verifies if a confirmation is Confirmation present. Present Wait For Waits for the confirmation the pattern that should appear as the Confirmation matching the pattern to appear. confirmation.

Arg2

Name Wait For Confirmation Not Present Wait For Confirmation Present

Description Waits for a confirmation not to be present. Waits for a confirmation to be present.

Arg1

Arg2

Das könnte Ihnen auch gefallen