public class SeleniumScripter extends Object
| Modifier and Type | Class and Description |
|---|---|
class |
SeleniumScripter.StopIteration |
| Modifier and Type | Field and Description |
|---|---|
static org.slf4j.Logger |
LOG |
| Constructor and Description |
|---|
SeleniumScripter(org.openqa.selenium.WebDriver driver) |
SeleniumScripter(org.openqa.selenium.WebDriver driver,
boolean DEV_MODE) |
| Modifier and Type | Method and Description |
|---|---|
void |
dumpStackOperation(Map<String,Object> script)
DEV TOOL
Dumps the stack of snapshots to a directory, creating a `.html` file for each entry in the stack in the
target directory
|
String |
getElementXPath(org.openqa.selenium.WebElement element)
Fetch the absolute (unoptimized) xpath of a specified web element.
|
Map<String,String> |
getSnapshots()
Return the snapshots stack.
|
void |
runScript(Map<String,Object> script)
Run a selenium script.
|
void |
screenshotOperation(Map<String,Object> script)
Take a screenshot (rasterize image) of the current page.
|
void |
setOutputPath(String path)
Set the path to the directory where operations like `screenshot` and `dumpstack` will start at when determining
their file output paths
|
static List |
slice(String slice,
List list)
Slice an array into a sublist
|
static String |
version() |
public SeleniumScripter(org.openqa.selenium.WebDriver driver)
public SeleniumScripter(org.openqa.selenium.WebDriver driver,
boolean DEV_MODE)
public static final String version()
public static List slice(String slice, List list) throws ParseException
slice - the slice string which must conform to the pattern `^-{0,1}[0-9]+:-{0,1}[0-9]+$`list - the list to sliceParseException - occurs when an invalid slice string is specifiedpublic String getElementXPath(org.openqa.selenium.WebElement element)
element - the web element to fetch the path ofpublic void runScript(Map<String,Object> script) throws IOException, AttributeNotFoundException, ParseException, InterruptedException, SeleniumScripter.StopIteration
script - the serialized selenium scriptIOException - occurs when a snapshot image failed to save to diskAttributeNotFoundException - occurs when an attribute on a selected element does not existParseException - occurs when one or more required fields are missing or an invalid value is specifiedIOException - occurs when screenshots failed to write to persistenceAttributeNotFoundException - occurs when an invalid element attribute is specifiedParseException - occurs when the token parsing fails to completeInterruptedException - occurs when the process wakes up from a sleep event in a child-instructionSeleniumScripter.StopIteration - occurs when a break statement is called outside of a looppublic void setOutputPath(String path)
path - the base path to start withpublic void screenshotOperation(Map<String,Object> script) throws IOException, ParseException
script - the screenshot subscript operationIOException - occurs when a screenshot image fails to write to persistenceParseException - occurs when the tokens failed to parsepublic void dumpStackOperation(Map<String,Object> script) throws ParseException, IOException
script - the dumpscript subscript operationParseException - occurs when the tokens failed to parseIOException - occurs when the snapshots failed to write to persistenceCopyright © 2022. All rights reserved.