Saturday, September 24, 2011

Selenium Commands, Seleness commands. By.www.laxmiroy.blogspot.com/

Download Selenium Commands, Seleness commands. By.www.laxmiroy.blogspot.com/

Frequently used Selenium Commands:



 S.No
                Command
            Description
1
assignId("Locator","String")
Temporarily sets the "id" attribute of the specified element
2
captureScreenshot("File name")
Captures a PNG screenshot to the specified file.
3
Check("Locator")
Check a toggle-button (checkbox/radio)
4
click("Locator")
Clicks on a link, button, checkbox or radio button.
5
clickAt("Locator","Coordinate String")
Clicks on a link, button, checkbox or radio button.
6
close()
Simulates the user clicking the "close" button in the title bar of a popup window or tab.
7
doubleClick("Locator")
Double clicks on a link, button, checkbox or radio button.
8
doubleClickAt("Locator","Coordinate String")
Double clicks on a link, button, checkbox or radio button.
9
getAlert()
Retrieves the message of a JavaScript alert generated during the previous action, or fail if there were no alerts.
10
getAllButtons()
Returns the IDs of all buttons on the page.
11
getAllFields()
Returns the IDs of all input fields on the page.
12
getAllLinks()
Returns the IDs of all links on the page.
13
getAllWindowIds()
Returns the IDs of all windows that the browser knows about.
14
getAllWindowNames()
Returns the names of all windows that the browser knows about.
15
getAllWindowTitles()
Returns the titles of all windows that the browser knows about.
16
getAttribute("Attribute Locator")
Gets the value of an element attribute.
17
getBodyText()
Gets the entire text of the page.
18
getConfirmation()
Retrieves the message of a JavaScript confirmation dialog generated during the previous action.
19
getCookie()
 Return all cookies of the current page under test.
20
getElementHeight("Locator")
Retrieves the height of an element
21
getElementPositionLeft("Locator")
Retrieves the horizontal position of an element
22
getElementPositionTop("Locator")
Retrieves the vertical position of an element
23
getElementWidth("Locator")
Retrieves the width of an element
24
getEval("JS Expression")
 Gets the result of evaluating the specified JavaScript snippet.
25
getLocation()
Gets the absolute URL of the current page.
26
getMouseSpeed()
Returns the number of pixels between "mousemove" events during dragAndDrop commands (default=10).
27
getPrompt()
Retrieves the message of a JavaScript question prompt dialog generated during the previous action.
28
getSelectedId("Select Locator")
Gets option element ID for selected option in the specified select element.
29
getSelectedIds("Select Locator")
Gets all option element IDs for selected options in the specified select or multi-select element.
30
getSelectedIndex("Select Locator")
Gets option index (option number, starting at 0) for selected option in the specified select element.
31
getSelectedIndexes("Select Locator")
Gets all option indexes (option number, starting at 0) for selected options in the specified select or multi-select element.
32
getSelectedLable("Select Locator")
Gets option label (visible text) for selected option in the specified select element.
33
getSelectedLables("Select Locator")
Gets all option labels (visible text) for selected options in the specified select or multi-select element.
34
getSelectedValue("Select Locator")
Gets option value (value attribute) for selected option in the specified select element.
35
getSelectedValues("Select Locator")
Gets all option values (value attributes) for selected options in the specified select or multi-select element.
36
getSelectOptions("Select Locator")
Gets all option labels in the specified select drop-down.
37
getSpeed()
Get execution speed (i.e., get the millisecond length of the delay following each selenium operation).
38
getTable("Table Cell Address”)
Gets the text from a cell of a table.
39
getText("Locator")
Gets the text of an element.
40
getTitle()
Gets the title of the current page.
41
getValue("Locator")
Gets the (whitespace-trimmed) value of an input field (or anything else with a value parameter).
42
getWhetherThisFrameMatchFrameExpression("Current Frame","Target")
Determine whether current/locator identify the frame containing this running code
43
getWhetherThisWindowMatchWindowExpression("Current Window","Target")
 Determine whether currentWindow String plus target identify the window containing this running code.
44
goBack()
Simulates the user clicking the "back" button on their browser.
45
highlight("Locator")
Briefly changes the backgroundColor of the specified element yellow.
46
isAlertPresent()
Has an alert occurred?
47
isChecked("Locator")
 Gets whether a toggle-button (checkbox/radio) is checked.
48
isConfirmationPresent()
Has confirm() been called?
49
isEditable("Locator")
Determines whether the specified input element is editable, ie hasn't been disabled.
50
isElementPresent("Locator")
Verifies that the specified element is somewhere on the page.
51
isPromptPresent()
 Has a prompt occurred?
52
isSomethingSelected("Locator")
Determines whether some option in a drop-down menu is selected.
53
isTextPresent("Pattern")
Verifies that the specified text pattern appears somewhere on the rendered page shown to the user.
54
isVisible("Locator")
Determines if the specified element is visible.
55
open("URL")
Opens an URL in the test frame.
56
openWindow("URL","WindowID")
Opens a popup window (if a window with that ID isn't already open).
57
refresh()
 Simulates the user clicking the "Refresh" button on their browser.
58
removeAllSelections("Locator")
Unselects all of the selected options in a multi-select element.
59
removeSelection("Locator","Option Locator")
Remove a selection from the set of selected options in a multi-select element using an option locator.
60
select("Select Locator","Option Locator")
Select an option from a drop-down using an option locator.
61
selectFrame("Locator")
Selects a frame within the current window.
62
selectWindow("WindowID")
Selects a popup window; once a popup window has been selected, all commands go to that window.
63
setSpeed("Value")
Set execution speed (i.e., set the millisecond length of a delay which will follow each selenium operation).
64
setTimeout("Time")
Specifies the amount of time that Selenium will wait for actions to complete.
65
start()
 Launches the browser with a new Selenium session
66
stop()
Ends the test session, killing the browser
67
submit("Form Locator")
Submit the specified form.
68
type("Locator","Value")
 Sets the value of an input field, as though you typed it in.
69
unCheck("Locator")
 Uncheck a toggle-button (checkbox/radio)
70
waitForCondition("JavaScript","Timeout")
Runs the specified JavaScript snippet repeatedly until it evaluates to "true".
71
waitForFrameToLoad("Frame Address","Timeout")
Waits for a new frame to load.
72
waitForPageToLoad("Timeout")
Waits for a new page to load.
73
waitForPopUp("WindowID","Timeout")
Waits for a popup window to appear and load up.
74
windowFocus()
 Gives focus to the currently selected window
75
windowMaximize()
Resize currently selected window to take up the entire screen

Handling Keyboard and Mouse:
 S.No
                         Command
              Description
1
altKeyDown()
 Press the Alt key and hold it down until AltUp() is called or a new page is loaded.
2
altKeyUp()
  Release the Alt key.
3
controlKeyDown()
 Press the Control key and hold it down until ControlUp() is called or a new page is loaded.
4
controlKeyUp()
 Release the Control key.
5
keyDown("Locator","Key Sequence")
 Simulates a user pressing a key (without releasing it yet).
6
keyUp("Locator","Key Sequence")
 Simulates a user releasing a key.
7
KeyPress("Locator","Key Sequence")
 Simulates a user pressing and releasing a key.
8
metaKeyDown()
 Press the meta key and hold it down until MetaUp() is called or a new page is loaded.
9
metaKeyUp()
 Release the meta key.
10
mouseDown("Locator")
  Simulates a user pressing the mouse button (without releasing it yet) on the specified element.
11
mouseDownAt("Locator","Coordinate String")
 Simulates a user pressing the mouse button (without releasing it yet) at the specified location.
12
mouseMove("Locator")
 Simulates a user pressing the mouse button (without releasing it yet) on the specified element.
13
mouseMoveAt("Locator","Coordinate String")
 Simulates a user pressing the mouse button (without releasing it yet) on the specified element.
14
mouseOut("Locator")
 Simulates a user moving the mouse pointer away from the specified element.
15
mouseOver("Locator")
 Simulates a user hovering a mouse over the specified element.
16
mouseUp("Locator")
 Simulates the event that occurs when the user releases the mouse button (i.e., stops holding the button down) on the specified element.
17
mouseUpAt("Locator","Coordinate String")
 Simulates the event that occurs when the user releases the mouse button (i.e., stops holding the button down) at the specified location.
18
shiftKeyDown()
 Press the shift key and hold it down until doShiftUp() is called or a new page is loaded.
19
shiftKeyUp()
  Release the shift key.


S.No
Object/Property
Command
1
Text Box
getValue(), getText(), isEditable(), isVisible(), type()
2
List Box
getSelectedId(),getSelectedIndex(), , getSelectedLabel(),getSelectedValue(), getSelectOptions(), select()
3
Multi Select Element
getSelectedIds(),getSelectedIndexes(), getSelectedLabels(),getSelectedValues(),isSomethingSelected()
4
Radio Button
check(), click(), isChecked()
5
Check Box
Check(), click(),isChecked(), uncheck()
6
Button
click()
7
Link
click(), getAllLinks()
8
Text
getText(),getBodyText()
9
Tables and Cells
getTable()



No comments:

Post a Comment