@Component public class BrowserInteropUtilsImpl extends java.lang.Object implements BrowserInteropUtils
Constructor and Description |
---|
BrowserInteropUtilsImpl() |
Modifier and Type | Method and Description |
---|---|
void |
acceptAlert(@NotNull org.openqa.selenium.WebDriver webDriver)
Accepts a browser alert
|
void |
cancelAlert(@NotNull org.openqa.selenium.WebDriver webDriver)
Cancels a browser alert
|
org.openqa.selenium.WebElement |
clickObjectElementByXPath(@NotNull org.openqa.selenium.WebElement object,
@NotNull org.openqa.selenium.JavascriptExecutor js,
@NotNull java.lang.String xpath,
boolean ignoreMissing) |
void |
focusOnElement(@NotNull org.openqa.selenium.WebDriver webDriver,
@NotNull org.openqa.selenium.WebElement element)
Deals with inconsistencies between browsers in how they focus on items
|
org.openqa.selenium.WebElement |
getLinkByText(@NotNull org.openqa.selenium.WebDriver webDriver,
@NotNull java.lang.String text) |
void |
maximizeWindow()
Maximizes the browser window
|
void |
populateElement(@NotNull org.openqa.selenium.WebDriver webDriver,
@NotNull org.openqa.selenium.WebElement element,
@NotNull java.lang.String value)
Send the keys to the element
|
void |
selectFromDropDownList(@NotNull org.openqa.selenium.WebDriver webDriver,
@NotNull org.openqa.selenium.WebElement element,
@NotNull java.lang.String selectElement)
Deals with inconsistencies between browsers in how they select items from a drop down list
|
void |
setup()
https://github.com/detro/ghostdriver/issues/20
Replace window.alert and window.confirm for PhantomJS
|
void |
setWindowSize(int width,
int height)
Sets the window size
|
boolean |
treatElementAsHidden(@NotNull org.openqa.selenium.WebDriver webDriver,
@NotNull org.openqa.selenium.WebElement element,
@NotNull org.openqa.selenium.JavascriptExecutor js)
PhantomJS has issues with links to javascript or hashes.
|
void |
waitForAlert(@NotNull org.openqa.selenium.WebDriver webDriver,
int waitDuration)
Waits for an alert
|
public boolean treatElementAsHidden(@NotNull @NotNull org.openqa.selenium.WebDriver webDriver, @NotNull @NotNull org.openqa.selenium.WebElement element, @NotNull @NotNull org.openqa.selenium.JavascriptExecutor js)
BrowserInteropUtils
treatElementAsHidden
in interface BrowserInteropUtils
webDriver
- The selenium webdriverelement
- The element to checkjs
- The javascript executor (which may or may not be the same object as webDriver)public void selectFromDropDownList(@NotNull @NotNull org.openqa.selenium.WebDriver webDriver, @NotNull @NotNull org.openqa.selenium.WebElement element, @NotNull @NotNull java.lang.String selectElement)
BrowserInteropUtils
selectFromDropDownList
in interface BrowserInteropUtils
webDriver
- The selenium webdriverelement
- The drop down listselectElement
- The item that we want to selectpublic void focusOnElement(@NotNull @NotNull org.openqa.selenium.WebDriver webDriver, @NotNull @NotNull org.openqa.selenium.WebElement element)
BrowserInteropUtils
focusOnElement
in interface BrowserInteropUtils
webDriver
- The selenium webdriverelement
- The element to focus onpublic org.openqa.selenium.WebElement getLinkByText(@NotNull @NotNull org.openqa.selenium.WebDriver webDriver, @NotNull @NotNull java.lang.String text)
getLinkByText
in interface BrowserInteropUtils
webDriver
- The selenium webdrivertext
- The text content of the linkpublic void maximizeWindow()
BrowserInteropUtils
maximizeWindow
in interface BrowserInteropUtils
public void setWindowSize(int width, int height)
BrowserInteropUtils
setWindowSize
in interface BrowserInteropUtils
width
- The window widthheight
- The window heightpublic void setup()
public void waitForAlert(@NotNull @NotNull org.openqa.selenium.WebDriver webDriver, int waitDuration)
BrowserInteropUtils
waitForAlert
in interface BrowserInteropUtils
webDriver
- The selenium webdriverwaitDuration
- How long to wait forpublic void acceptAlert(@NotNull @NotNull org.openqa.selenium.WebDriver webDriver)
BrowserInteropUtils
acceptAlert
in interface BrowserInteropUtils
webDriver
- The selenium webdriverpublic void cancelAlert(@NotNull @NotNull org.openqa.selenium.WebDriver webDriver)
BrowserInteropUtils
cancelAlert
in interface BrowserInteropUtils
webDriver
- The selenium webdriverpublic void populateElement(@NotNull @NotNull org.openqa.selenium.WebDriver webDriver, @NotNull @NotNull org.openqa.selenium.WebElement element, @NotNull @NotNull java.lang.String value)
BrowserInteropUtils
populateElement
in interface BrowserInteropUtils
webDriver
- The webdriverelement
- The element to populatevalue
- The value to enter into the elementpublic org.openqa.selenium.WebElement clickObjectElementByXPath(@NotNull @NotNull org.openqa.selenium.WebElement object, @NotNull @NotNull org.openqa.selenium.JavascriptExecutor js, @NotNull @NotNull java.lang.String xpath, boolean ignoreMissing)
clickObjectElementByXPath
in interface BrowserInteropUtils