public class Selenium2Library
extends org.robotframework.javalib.library.AnnotationLibrary
| Element Type | Key Attributes |
| A | @id,@name,@href,text |
| IMG | @id,@name,@src,@alt |
| INPUT | @id,@name,@value,@src |
| BUTTON | @id,@name,@value,text |
| * | @id,@name |
| Click Element | my_element |
| Strategy | Example | Description |
| identifier | Click Element | identifier=my_element | Matches by @id or @name attribute |
| id | Click Element | id=my_element | Matches by @id attribute |
| name | Click Element | name=my_element | Matches by @name attribute |
| xpath | Click Element | xpath=//div[@id='my_element'] | Matches by arbitrary XPath expression |
| dom | Click Element | dom=document.images[56] | Matches by arbitrary DOM expression |
| link | Click Element | link=My Link | Matches by the link text |
| css | Click Element | css=div.my_class | Matches by CSS selector |
| jquery | Click Element | jquery=div.my_class | Matches by jQuery/sizzle selector |
| sizzle | Click Element | sizzle=div.my_class | Matches by jQuery/sizzle selector |
| tag | Click Element | tag=div | Matches by HTML tag name |
| Table Should Contain | my_table | text |
| Strategy | Example | Description | xpath | Table Should Contain | xpath=//table/[@name="my_table"] | text | Matches by arbitrary XPath expression | css | Table Should Contain | css=table.my_class | text | Matches by CSS selector |
| Add Location Strategy | custom | return window.document.getElementById(arguments[0]); |
| Input Text | custom=firstName | Max |
| Log Level | Description |
| DEBUG | |
| INFO | |
| HTML | Same as INFO, but message is in HTML format |
| TRACE | |
| WARN |
| Modifier and Type | Field and Description |
|---|---|
protected BrowserManagement |
browserManagement
Instantiated BrowserManagement keyword bean
|
protected Cookie |
cookie
Instantiated Cookie keyword bean
|
protected Element |
element
Instantiated Element keyword bean
|
protected FormElement |
formElement
Instantiated FormElement keyword bean
|
static Javadoc2Libdoc |
JAVADOC_2_LIBDOC
The javadoc to libdoc converter
|
protected JavaScript |
javaScript
Instantiated JavaScript keyword bean
|
static String |
KEYWORD_PATTERN
The list of keyword patterns for the AnnotationLibrary
|
protected Logging |
logging
Instantiated Logging keyword bean
|
static String |
ROBOT_LIBRARY_DOC_FORMAT
The library documentation is written in HTML
|
static String |
ROBOT_LIBRARY_SCOPE
The scope of this library is global.
|
static String |
ROBOT_LIBRARY_VERSION
The actual version of this library.
|
protected RunOnFailure |
runOnFailure
Instantiated RunOnFailure keyword bean
|
protected Screenshot |
screenshot
Instantiated Screenshot keyword bean
|
protected SelectElement |
selectElement
Instantiated SelectElement keyword bean
|
protected TableElement |
tableElement
Instantiated TableElement keyword bean
|
protected Waiting |
waiting
Instantiated Waiting keyword bean
|
| Constructor and Description |
|---|
Selenium2Library() |
Selenium2Library(String timeout) |
Selenium2Library(String timeout,
String implicitWait) |
Selenium2Library(String timeout,
String implicitWait,
String runOnFailure)
Selenium2Library can be imported with optional arguments.
|
| Modifier and Type | Method and Description |
|---|---|
BrowserManagement |
getBrowserManagement() |
Cookie |
getCookie() |
Element |
getElement() |
FormElement |
getFormElement() |
JavaScript |
getJavaScript() |
String |
getKeywordDocumentation(String keywordName) |
static Selenium2Library |
getLibraryInstance() |
Logging |
getLogging() |
RunOnFailure |
getRunOnFailure() |
Screenshot |
getScreenshot() |
SelectElement |
getSelectElement() |
TableElement |
getTableElement() |
Waiting |
getWaiting() |
Object |
runKeyword(String keywordName,
Object[] args) |
protected Object[] |
toStrings(Object[] args)
Convert all arguments in the object array to string
|
addKeywordPattern, autowireFields, createKeywordFactory, getKeywordArgumentspublic static final String KEYWORD_PATTERN
public static final Javadoc2Libdoc JAVADOC_2_LIBDOC
public static final String ROBOT_LIBRARY_DOC_FORMAT
public static final String ROBOT_LIBRARY_SCOPE
public static final String ROBOT_LIBRARY_VERSION
protected BrowserManagement browserManagement
protected Cookie cookie
protected Element element
protected FormElement formElement
protected JavaScript javaScript
protected Logging logging
protected RunOnFailure runOnFailure
protected Screenshot screenshot
protected SelectElement selectElement
protected TableElement tableElement
protected Waiting waiting
public Selenium2Library()
public Selenium2Library(String timeout)
public Selenium2Library(String timeout, String implicitWait, String runOnFailure)
| Library | Selenium2Library | ||||
| Library | Selenium2Library | 15 | # Sets timeout to 15 seconds | ||
| Library | Selenium2Library | 0 | 5 | # Sets timeout to 0 seconds and implicitWait to 5 seconds | |
| Library | Selenium2Library | 0 | 5 | Log Source | # Sets timeout to 0 seconds, implicitWait to 5 seconds and runs `Log Source` on failure |
| Library | Selenium2Library | 0 | 5 | Nothing | # Sets timeout to 0 seconds, implicitWait to 5 seconds and does nothing on failure |
timeout - Default=5.0. Optional custom timeout.implicitWait - Default=0.0. Optional custom implicit wait time.runOnFailure - Default=Capture Page Screenshot. Optional custom keyword to
run on failure.public BrowserManagement getBrowserManagement()
public Cookie getCookie()
public Element getElement()
public FormElement getFormElement()
public JavaScript getJavaScript()
public Logging getLogging()
public RunOnFailure getRunOnFailure()
public Screenshot getScreenshot()
public SelectElement getSelectElement()
public TableElement getTableElement()
public Waiting getWaiting()
public Object runKeyword(String keywordName, Object[] args)
runKeyword in interface org.robotframework.javalib.library.RobotJavaLibraryrunKeyword in class org.robotframework.javalib.library.AnnotationLibrarypublic String getKeywordDocumentation(String keywordName)
getKeywordDocumentation in interface org.robotframework.javalib.library.KeywordDocumentationRepositorygetKeywordDocumentation in class org.robotframework.javalib.library.AnnotationLibrarypublic static Selenium2Library getLibraryInstance() throws ScriptException
ScriptExceptionCopyright © 2014. All rights reserved.