Professional Documents
Culture Documents
Class Description
DefaultRemoteCom A representation of a single remote Command
mand
DefaultSelenium Defines an object that runs Selenium commands.
Element Locators
locatorType=argument
o name=flavour value=chocolate
• dom=javascriptExpression: Find an element by evaluating the
specified string. This allows you to traverse the HTML Document
Object Model using JavaScript. Note that you must not return a
value in this string; simply make it the last expression in the block.
o dom=document.forms['myForm'].myDropdown
o dom=document.images[56]
o dom=function foo() { return document.links[1]; }; foo();
• xpath=xpathExpression: Locate an element using an XPath
expression.
o xpath=//img[@alt='The image alt text']
o xpath=//table[@id='table1']//tr[4]/td[2]
o xpath=//a[contains(@href,'#id1')]
o xpath=//a[contains(@href,'#id1')]/@class
o xpath=(//table[@class='stylee'])//th[text()='theHeaderText']/
../td
o xpath=//input[@name='name2' and @value='yes']
o xpath=//*[text()="right"]
• link=textPattern: Select the link (anchor) element which contains
text matching the specified pattern.
o link=The link text
• css=cssSelectorSyntax: Select the element using css selectors.
Please refer to CSS2 selectors, CSS3 selectors for more
information. You can also check the TestCssLocators test in the
selenium test suite for an example of usage, which is included in
the downloaded selenium core package.
o css=a[href="#id3"]
o css=span#firstChild + span
Currently the css selector locator supports all css1, css2 and css3
selectors except namespace in css3, some pseudo classes(:nth-of-
type, :nth-last-of-type, :first-of-type, :last-of-type, :only-of-type,
:visited, :hover, :active, :focus, :indeterminate) and pseudo
elements(::first-line, ::first-letter, ::selection, ::before, ::after).
Element Filters
filterType=argument
value=valuePattern
index=index
Selects a single element based on its position in the list (offset from zero).
String-match Patterns
Interfaces
Interface Description
ICommandProces Provides a DoCommand method, which sends the command to the browser to
sor be performed.
IRemoteComman Summary description for IRemoteCommand.
d
ISelenium Defines an object that runs Selenium commands.
Element Locators
Element Locators tell Selenium which HTML element a command refers to.
The format of a locator is:
locatorType=argument
o name=flavour value=chocolate
• dom=javascriptExpression: Find an element by evaluating the
specified string. This allows you to traverse the HTML Document
Object Model using JavaScript. Note that you must not return a value
in this string; simply make it the last expression in the block.
o dom=document.forms['myForm'].myDropdown
o dom=document.images[56]
o dom=function foo() { return document.links[1]; }; foo();
• xpath=xpathExpression: Locate an element using an XPath
expression.
o xpath=//img[@alt='The image alt text']
o xpath=//table[@id='table1']//tr[4]/td[2]
o xpath=//a[contains(@href,'#id1')]
o xpath=//a[contains(@href,'#id1')]/@class
o xpath=(//table[@class='stylee'])//th[text()='theHeaderText']/../t
d
o xpath=//input[@name='name2' and @value='yes']
o xpath=//*[text()="right"]
• link=textPattern: Select the link (anchor) element which contains text
matching the specified pattern.
o link=The link text
• css=cssSelectorSyntax: Select the element using css selectors. Please
refer to CSS2 selectors, CSS3 selectors for more information. You can
also check the TestCssLocators test in the selenium test suite for an
example of usage, which is included in the downloaded selenium core
package.
o css=a[href="#id3"]
o css=span#firstChild + span
Currently the css selector locator supports all css1, css2 and css3
selectors except namespace in css3, some pseudo classes(:nth-of-
type, :nth-last-of-type, :first-of-type, :last-of-type, :only-of-type,
:visited, :hover, :active, :focus, :indeterminate) and pseudo
elements(::first-line, ::first-letter, ::selection, ::before, ::after).
Element Filters
filterType=argument
value=valuePattern
Matches elements based on their values. This is particularly useful for refining
a list of similarly-named toggle-buttons.
index=index
Selects a single element based on its position in the list (offset from zero).
String-match Patterns