public class SeleniumFixture extends Object
| Constructor and Description |
|---|
SeleniumFixture() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
actionClick()
| action click |
|
boolean |
actionClick(String locator)
| ensure | action click | selector |
|
boolean |
actionClickAndHold()
| action click and hold |
|
boolean |
actionClickAndHold(String locator)
| ensure | action click and hold | selector |
|
boolean |
actionContextClick()
| action context click |
|
boolean |
actionContextClick(String locator)
| ensure | action context click | selector |
|
boolean |
actionDoubleClick()
| action double click |
|
boolean |
actionDoubleClick(String locator)
| ensure | action double click | selector |
|
boolean |
actionMoveByOffsetAnd(int xOffset,
int yOffset)
| ensure | action move by offset | x-offset | and | y-offset |
|
boolean |
actionMoveToElement(String locator)
| ensure | action move to element | locator |
|
boolean |
actionMoveToElementAtAnd(String locator,
int xOffset,
int yOffset)
| ensure | action move to element | locator | at | x-offset | and | y-offset |
|
boolean |
actionPause(long pause)
| ensure | action pause | milliseconds |
|
boolean |
actionRelease()
| action release |
|
boolean |
actionRelease(String locator)
| ensure | action release | selector |
|
String |
attributeIn(String attributeName,
String locator)
| check | attribute | attributeName | in | locator | expectedValue |
|
boolean |
click()
| click |
|
boolean |
click(String locator)
| click | locator |
|
boolean |
closeBrowserTab()
| close browser tab |
|
String |
currentUrl()
| check | current url | url |
|
String |
currentUrl(String expectedUrl)
| check | current url | url | url |
|
String |
currentWindow()
| show | current window |
|
String |
currentWindow(String expectedWindowHandle)
| check | current window | windowHandle | windowHandle |
|
boolean |
fileExists(String file)
| ensure | file exists | file |
|
String |
findElement(String locator)
| $elementId= | find element | locator |
Finds an element and returns a webelement locator which can be used in other methods. |
static WebDriverHelper |
getDriver()
Expose the driver helper to allow other fixtures to extend this.
|
boolean |
goBack()
| go back |
|
boolean |
goForward()
| go forward |
|
boolean |
isDisplayed(String locator)
| ensure | is displayed | locator |
|
boolean |
isEnabled(String locator)
| ensure | is enabled | locator |
|
boolean |
isSelected(String locator)
| ensure | is selected | locator |
|
long |
lastCommandDuration()
| check | last command duration | < duration in seconds |
|
boolean |
open(String url)
| open | url |
|
boolean |
openWindow(String url)
| open window | url |
|
boolean |
present(String locator)
| ensure | present | locator |
|
boolean |
quitBrowser()
| quit browser |
|
boolean |
refresh()
| refresh |
|
String |
runScript(String script)
| $result= | run script | code |
|
String |
screenshot()
| show | screenshot |
|
String |
screenshotOf(String locator)
| show | screenshot of | locator |
|
boolean |
select(String optionLocator)
| select | optionLocator |
|
String |
selected(String optionType)
| check | selected | optionType |
|
String |
selectedIn(String optionType,
String locator)
| check | selected | optionType | in | locator |
|
boolean |
selectFrame(String locator)
| select frame | locator |
|
boolean |
selectIn(String optionLocator,
String locator)
| select | optionLocator | in | locator |
|
boolean |
selectWindow(String locator)
| select window | locator |
|
boolean |
sendKeys(String value)
| send keys | value |
|
boolean |
sendKeysIn(String value,
String locator)
| send keys | value | in | locator |
|
String |
setDryRun(String enableDryRun) |
String |
setTakeScreenshotOnFailure(String shouldTake)
| set take screenshot on failure | true |
|
int |
setWaitTimeout(int timeoutInSeconds)
| $previousTimeout= | set wait timeout | timeout in seconds |
|
boolean |
setWindowSize(String widthAndHeight)
| set window size | [width]x[height] |
|
boolean |
startBrowser(String browser)
| start browser | browser |
|
boolean |
startBrowserWith(String browser,
String capabilities)
| start browser | browser | with | capabilities |
|
boolean |
startBrowserWithAndPreferences(String browser,
String capabilities,
String browserPreferences)
| start browser | browser | with | capabilities | and preferences | browser preferences |
|
boolean |
startBrowserWithPreferences(String browser,
String browserPreferences)
| start browser | browser | with preferences | browser preferences |
|
String |
stopTestOnFirstFailure(String shouldStop)
| stop test on first failure | true |
|
String |
text()
| show | text |
|
String |
text(String locator)
| check | text | locator |
|
String |
title()
| show | title |
|
String |
title(String expectedTitle)
| check | title | title |
|
boolean |
type(String value)
| type | value |
|
boolean |
typeIn(String value,
String locator)
| type | value | in | locator |
|
String |
value(String locator)
| check | value | locator | expectedValue |
|
String |
windowMaximize()
| window maximize |
|
String |
windowSize()
| window size |
|
String |
windowSize(String expectedWindowSize)
| window size |
|
public static WebDriverHelper getDriver()
public boolean startBrowser(String browser) throws ReflectiveOperationException, IOException
| start browser | browser |
browser - The browser to be usedReflectiveOperationException - if remote driver class cannot be instantiatedIOException - if IO error occurs if invalid URL is used when connecting to remote driversstartBrowserWith(String, String)public boolean startBrowserWith(String browser, String capabilities) throws ReflectiveOperationException, IOException
| start browser | browser | with | capabilities |
name='some test' platform='LINUX' version='xx'
This format was used instead of regular json format since FitNesse uses brackets for variables. Quotes between values must be usedbrowser - The browser to be usedcapabilities - Usually used to configure remote driver, but some local driver also uses. For example: name='some test' platform='LINUX' version='xx'ReflectiveOperationException - if remote driver class cannot be instantiatedIOException - if IO error occurs if invalid URL is used when connecting to remote driverspublic boolean startBrowserWithPreferences(String browser, String browserPreferences) throws ReflectiveOperationException, IOException
| start browser | browser | with preferences | browser preferences |
name='some test' platform='LINUX' version='xx'
This format was used instead of regular json format since FitNesse uses brackets for variables. Quotes between values must be usedbrowser - The browser to be usedbrowserPreferences - Allows profile configuration for some browser. At this moment supports Chrome and Firefox drivers (local and remote)ReflectiveOperationException - if remote driver class cannot be instantiatedIOException - if IO error occurs if invalid URL is used when connecting to remote driverspublic boolean startBrowserWithAndPreferences(String browser, String capabilities, String browserPreferences) throws ReflectiveOperationException, IOException
| start browser | browser | with | capabilities | and preferences | browser preferences |
key1='value1' key2='value2' key3='value3'
This format was used instead of regular json format since FitNesse uses brackets for variables. Quotes between values must be usedbrowser - The browser to be usedcapabilities - Usually used to configure remote driver, but some local driver also uses. For example: name='some test' platform='LINUX' version='xx'browserPreferences - Allows profile configuration for some browser. At this moment supports Chrome and Firefox drivers (local and remote)ReflectiveOperationException - if remote driver class cannot be instantiatedIOException - if IO error occurs if invalid URL is used when connecting to remote driverspublic int setWaitTimeout(int timeoutInSeconds)
| $previousTimeout= | set wait timeout | timeout in seconds |
timeoutInSeconds - wait seconds to timeoutpublic long lastCommandDuration()
| check | last command duration | < duration in seconds |
public boolean open(String url)
| open | url |
url - to navigatepublic boolean refresh()
| refresh |
public boolean goBack()
| go back |
public boolean goForward()
| go forward |
public String currentUrl()
| check | current url | url |
public String currentUrl(String expectedUrl)
| check | current url | url | url |
setWaitTimeout(int) before triggering failure. If using selenium table, please ignore this action.expectedUrl - that we'll wait forpublic boolean openWindow(String url)
| open window | url |
url - to navigateselectWindow(String)public boolean selectWindow(String locator)
| select window | locator |
locator - an element locatorpublic boolean selectFrame(String locator)
| select frame | locator |
locator - an element locatorpublic String currentWindow()
| show | current window |
public String currentWindow(String expectedWindowHandle)
| check | current window | windowHandle | windowHandle |
setWaitTimeout(int) before triggering failure. If using selenium table, please ignore this action.expectedWindowHandle - that we'll wait forpublic String windowMaximize()
| window maximize |
public boolean setWindowSize(String widthAndHeight)
| set window size | [width]x[height] |
widthAndHeight - windows size, in [width]x[height] formatIllegalArgumentException - if widthAndHeight is malformedpublic String windowSize()
| window size |
public String windowSize(String expectedWindowSize)
| window size |
setWaitTimeout(int) before triggering failure. If using selenium table, please ignore this action.expectedWindowSize - Expected window sizepublic String title()
| show | title |
public String title(String expectedTitle)
| check | title | title |
setWaitTimeout(int) before triggering failure. If using selenium table, please ignore this action.expectedTitle - that we'll wait forpublic boolean closeBrowserTab()
| close browser tab |
public boolean quitBrowser()
| quit browser |
public boolean type(String value)
| type | value |
value - the value to typeInpublic boolean typeIn(String value, String locator)
| type | value | in | locator |
value - the value to typeInlocator - an element locatorpublic boolean sendKeys(String value)
| send keys | value |
value - the value to typeInpublic boolean sendKeysIn(String value, String locator)
| send keys | value | in | locator |
value - the value to typeInlocator - an element locatorpublic boolean click()
| click |
public boolean click(String locator)
| click | locator |
locator - an element locatorpublic boolean select(String optionLocator)
| select | optionLocator |
optionLocator - option locator to be used for select actionpublic boolean selectIn(String optionLocator, String locator)
| select | optionLocator | in | locator |
optionLocator - option locator to be used for select actionlocator - an element locatorpublic String selected(String optionType)
| check | selected | optionType |
optionType - can be label, value or indexpublic String selectedIn(String optionType, String locator)
| check | selected | optionType | in | locator |
optionType - can be label, value or indexlocator - an element locatorpublic String value(String locator)
| check | value | locator | expectedValue |
locator - an element locatorpublic String attributeIn(String attributeName, String locator)
| check | attribute | attributeName | in | locator | expectedValue |
attributeName - the name of the attribute to retrieve the value fromlocator - an element locatorpublic String text()
| show | text |
If a dialog box is being presented on the page (such as an alert dialog), this action will return the dialog text
public String text(String locator)
| check | text | locator |
locator - an element locatorpublic String screenshot() throws IOException
| show | screenshot |
IOException - if something goes wrong while manipulating screenshot filepublic String screenshotOf(String locator) throws IOException
| show | screenshot of | locator |
IOException - if something goes wrong while manipulating screenshot filepublic boolean present(String locator)
| ensure | present | locator |
| reject | present | locator |
Note: Wait behavior won't work properly without selenium table
locator - an element locatorpublic String findElement(String locator)
| $elementId= | find element | locator |
Finds an element and returns a webelement locator which can be used in other methods.
locator - public String runScript(String script)
| $result= | run script | code |
script - the JavaScript snippet to runpublic String stopTestOnFirstFailure(String shouldStop)
| stop test on first failure | true |
shouldStop - If true or on, the test will stop if a failure occurs in any actionpublic String setTakeScreenshotOnFailure(String shouldTake)
| set take screenshot on failure | true |
shouldTake - If true or on, a screenshot will be appended (if possible) to a failed selenium operation.public boolean fileExists(String file)
| ensure | file exists | file |
Important: If you're using remote browsers such as Selenium Grid or SauceLabs, this action probably won't be useful, unless you have access to the node's remote file system.
file - Path of the file to check if existspublic boolean isDisplayed(String locator)
| ensure | is displayed | locator |
| reject | is displayed | locator |
Note: Wait behavior won't work properly without selenium table
locator - an element locatorpublic boolean isEnabled(String locator)
| ensure | is enabled | locator |
| reject | is enabled | locator |
Note: Wait behavior won't work properly without selenium table
locator - an element locatorpublic boolean isSelected(String locator)
| ensure | is selected | locator |
| reject | is selected | locator |
Note: Wait behavior won't work properly without selenium table
locator - an element locatorpublic boolean actionMoveToElement(String locator)
| ensure | action move to element | locator |
Note: Wait behavior won't work properly without selenium table
locator - an element locatorpublic boolean actionMoveToElementAtAnd(String locator, int xOffset, int yOffset)
| ensure | action move to element | locator | at | x-offset | and | y-offset |
Note: Wait behavior won't work properly without selenium table
locator - an element locatorxOffset - relative x offset in pixelsyOffset - relative y offset in pixelspublic boolean actionMoveByOffsetAnd(int xOffset,
int yOffset)
| ensure | action move by offset | x-offset | and | y-offset |
Note: Wait behavior won't work properly without selenium table
xOffset - relative x offset in pixelsyOffset - relative y offset in pixelspublic boolean actionClick()
| action click |
Note: Wait behavior won't work properly without selenium table
public boolean actionClick(String locator)
| ensure | action click | selector |
Note: Wait behavior won't work properly without selenium table
locator - an element locatorpublic boolean actionClickAndHold()
| action click and hold |
Note: Wait behavior won't work properly without selenium table
public boolean actionClickAndHold(String locator)
| ensure | action click and hold | selector |
Note: Wait behavior won't work properly without selenium table
locator - an element locatorpublic boolean actionDoubleClick()
| action double click |
Note: Wait behavior won't work properly without selenium table
public boolean actionDoubleClick(String locator)
| ensure | action double click | selector |
Note: Wait behavior won't work properly without selenium table
locator - an element locatorpublic boolean actionContextClick()
| action context click |
Note: Wait behavior won't work properly without selenium table
public boolean actionContextClick(String locator)
| ensure | action context click | selector |
Note: Wait behavior won't work properly without selenium table
locator - an element locatorpublic boolean actionRelease()
| action release |
Note: Wait behavior won't work properly without selenium table
public boolean actionRelease(String locator)
| ensure | action release | selector |
Note: Wait behavior won't work properly without selenium table
locator - an element locatorpublic boolean actionPause(long pause)
| ensure | action pause | milliseconds |
Note: Wait behavior won't work properly without selenium table
Copyright © 2018. All rights reserved.