Search This Blog

Showing posts with label Selenium Commands. Show all posts
Showing posts with label Selenium Commands. Show all posts

Wednesday, August 4, 2010

Selenium Commands - Part 1

K

keyDown(locator, keySequence)
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".
Simulates a user pressing a key (without releasing it yet).


keyDownAndWait(locator, keySequence)
Generated from keyDown(locator, keySequence)
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".
Simulates a user pressing a key (without releasing it yet).


keyPress(locator, keySequence)
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".
Simulates a user pressing and releasing a key.


keyPressAndWait(locator, keySequence)
Generated from keyPress(locator, keySequence)
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".
Simulates a user pressing and releasing a key.


keyUp(locator, keySequence)
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".
Simulates a user releasing a key.


keyUpAndWait(locator, keySequence)
Generated from keyUp(locator, keySequence)
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".
Simulates a user releasing a key.







H

highlight(locator)
Arguments:
• locator - an element locator
Briefly changes the backgroundColor of the specified element yellow. Useful for debugging.


highlightAndWait(locator)
Generated from highlight(locator)
Arguments:
• locator - an element locator
Briefly changes the backgroundColor of the specified element yellow. Useful for debugging.





G

getSpeed()
Get execution speed (i.e., get the millisecond length of the delay following each selenium operation). By default, there is no such delay, i.e., the delay is 0 milliseconds. See also setSpeed.


getSpeedAndWait()
Generated from getSpeed()
Get execution speed (i.e., get the millisecond length of the delay following each selenium operation). By default, there is no such delay, i.e., the delay is 0 milliseconds. See also setSpeed.


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


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


F

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


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


D

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


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


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


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


doubleClickAt(locator, coordString)
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.
Doubleclicks on a link, button, checkbox or radio button. If the action causes a new page to load (like a link usually does), call waitForPageToLoad.


doubleClickAtAndWait(locator, coordString)
Generated from doubleClickAt(locator, coordString)
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.
Doubleclicks on a link, button, checkbox or radio button. If the action causes a new page to load (like a link usually does), call waitForPageToLoad.


dragAndDrop(locator, movementsString)
Arguments:
• locator - an element locator
• movementsString - offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"
Drags an element a certain distance and then drops it


dragAndDropAndWait(locator, movementsString)
Generated from dragAndDrop(locator, movementsString)
Arguments:
• locator - an element locator
• movementsString - offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"
Drags an element a certain distance and then drops it


dragAndDropToObject(locatorOfObjectToBeDragged, locatorOfDragDestinationObject)
Arguments:
• locatorOfObjectToBeDragged - an element to be dragged
• locatorOfDragDestinationObject - an element whose location (i.e., whose center-most pixel) will be the point where locatorOfObjectToBeDragged is dropped
Drags an element and drops it on another element


dragAndDropToObjectAndWait(locatorOfObjectToBeDragged, locatorOfDragDestinationObject)
Generated from dragAndDropToObject(locatorOfObjectToBeDragged, locatorOfDragDestinationObject)
Arguments:
• locatorOfObjectToBeDragged - an element to be dragged
• locatorOfDragDestinationObject - an element whose location (i.e., whose center-most pixel) will be the point where locatorOfObjectToBeDragged is dropped
Drags an element and drops it on another element


dragdrop(locator, movementsString)
Arguments:
• locator - an element locator
• movementsString - offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"
deprecated - use dragAndDrop instead


dragdropAndWait(locator, movementsString)
Generated from dragdrop(locator, movementsString)
Arguments:
• locator - an element locator
• movementsString - offset in pixels from the current location to which the element should be moved, e.g., "+70,-300"
deprecated - use dragAndDrop instead


C

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


checkAndWait(locator)
Generated from check(locator)
Arguments:
• locator - an element locator
Check a toggle-button (checkbox/radio)


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)
Arguments:
• locator - an element 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.


clickAndWait(locator)
Generated from click(locator)
Arguments:
• locator - an element 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.


clickAt(locator, coordString)
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.
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.


clickAtAndWait(locator, coordString)
Generated from clickAt(locator, coordString)
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.
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.


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


controlKeyDown()
Press the control key and hold it down until doControlUp() is called or a new page is loaded.


controlKeyDownAndWait()
Generated from controlKeyDown()
Press the control key and hold it down until doControlUp() is called or a new page is loaded.


controlKeyUp()
Release the control key.


controlKeyUpAndWait()
Generated from controlKeyUp()
Release the control key.


createCookie(nameValuePair, optionsString)
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.
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.


createCookieAndWait(nameValuePair, optionsString)
Generated from createCookie(nameValuePair, optionsString)
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.
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.