Class JSUtils
- java.lang.Object
-
- eu.tsystems.mms.tic.testframework.utils.JSUtils
-
public final class JSUtils extends java.lang.ObjectJavaScript Utils.
-
-
Constructor Summary
Constructors Constructor Description JSUtils()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddJavascriptResources(org.openqa.selenium.WebDriver webDriver, java.util.stream.Stream<java.lang.String> resourceFiles)voidclick(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement webElement)voidclickAbsolute(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement webElement)voiddoubleClick(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement webElement)static java.lang.ObjectexecuteAsyncScript(org.openqa.selenium.WebDriver driver, java.lang.String script, java.lang.Object... parameters)executing async scriptstatic voidexecuteJavaScriptMouseAction(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement containerWebElement, JSMouseAction type, int x, int y)Execute a JS MouseAction on a driver session.static java.lang.ObjectexecuteScript(org.openqa.selenium.WebDriver driver, java.lang.String script, java.lang.Object... parameters)Try to execute javascript.static java.lang.ObjectexecuteScriptWOCatch(org.openqa.selenium.WebDriver driver, java.lang.String script, java.lang.Object... parameters)Try to execute javascript.static java.util.Map<java.lang.String,java.lang.Long>getElementInnerBorders(UiElement guiElement)Deprecated.Use by deprecatedLayoutstatic org.openqa.selenium.PointgetElementLocationInParent(UiElement guiElement, eu.tsystems.mms.tic.testframework.utils.JSUtils.Where where)static java.lang.StringgetJavaScriptSelector(GuiElement element)Deprecated.org.openqa.selenium.RectanglegetViewport(org.openqa.selenium.WebDriver driver)Will get the viewport by executing JavaScript to determine innerwith and offsetsvoidhighlight(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement webElement, java.awt.Color color)static voidhighlightWebElement(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement webElement, java.awt.Color color)Deprecated.Usehighlight(WebDriver, WebElement, Color)insteadstatic voidimplementJavascriptOnPage(org.openqa.selenium.WebDriver driver, java.lang.String resourceFile, java.lang.String id)Deprecated.UseaddJavascriptResources(WebDriver, Stream)insteadvoidmouseOver(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement webElement)voidmouseOverAbsolute2Axis(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement webElement)voidrightClick(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement webElement)voidscrollElementToTop(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement webElement)Scrolls an element to the top of a page.voidscrollToCenter(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement webElement, org.openqa.selenium.Point offset)Scrolls the element to the center of the viewportvoidscrollToTop(org.openqa.selenium.WebDriver webDriver)Scroll to top of page.
-
-
-
Method Detail
-
addJavascriptResources
public void addJavascriptResources(org.openqa.selenium.WebDriver webDriver, java.util.stream.Stream<java.lang.String> resourceFiles)
-
implementJavascriptOnPage
@Deprecated public static void implementJavascriptOnPage(org.openqa.selenium.WebDriver driver, java.lang.String resourceFile, java.lang.String id)Deprecated.UseaddJavascriptResources(WebDriver, Stream)insteadtry to implement javascript on page- Parameters:
driver- .resourceFile- .id- .
-
executeAsyncScript
public static java.lang.Object executeAsyncScript(org.openqa.selenium.WebDriver driver, java.lang.String script, java.lang.Object... parameters)executing async script- Parameters:
driver- .script- .parameters- .- Returns:
- .
-
executeScriptWOCatch
public static java.lang.Object executeScriptWOCatch(org.openqa.selenium.WebDriver driver, java.lang.String script, java.lang.Object... parameters)Try to execute javascript. If an error occurs it will be thrown.- Parameters:
driver- .script- .parameters- .- Returns:
- .
-
executeScript
public static java.lang.Object executeScript(org.openqa.selenium.WebDriver driver, java.lang.String script, java.lang.Object... parameters)Try to execute javascript. If an error occurs it will be logged only.- Parameters:
driver- .script- .parameters- .- Returns:
- .
-
highlight
public void highlight(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement webElement, java.awt.Color color)
-
highlightWebElement
public static void highlightWebElement(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement webElement, java.awt.Color color)Deprecated.Usehighlight(WebDriver, WebElement, Color)insteadHighlights an element for a specified time.
-
executeJavaScriptMouseAction
public static void executeJavaScriptMouseAction(org.openqa.selenium.WebDriver driver, org.openqa.selenium.WebElement containerWebElement, JSMouseAction type, int x, int y)Execute a JS MouseAction on a driver session.- Parameters:
driver- .containerWebElement- .type- .x- .y- .
-
scrollToTop
public void scrollToTop(org.openqa.selenium.WebDriver webDriver)
Scroll to top of page.- Parameters:
webDriver- WebDriver instance.
-
scrollElementToTop
public void scrollElementToTop(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement webElement)Scrolls an element to the top of a page.- Parameters:
webDriver-webElement-
-
getJavaScriptSelector
@Deprecated public static java.lang.String getJavaScriptSelector(GuiElement element)
Deprecated.Get a javascript based selector including frame hierarchy by extracting the By-Property of GuiElement Uses Reflection- Parameters:
element- GuiElement- Returns:
- String
-
getElementInnerBorders
@Deprecated public static java.util.Map<java.lang.String,java.lang.Long> getElementInnerBorders(UiElement guiElement)
Deprecated.Use by deprecatedLayout
-
getViewport
public org.openqa.selenium.Rectangle getViewport(org.openqa.selenium.WebDriver driver)
Will get the viewport by executing JavaScript to determine innerwith and offsets- Parameters:
driver-WebDriver- Returns:
- Rectangle
-
getElementLocationInParent
public static org.openqa.selenium.Point getElementLocationInParent(UiElement guiElement, eu.tsystems.mms.tic.testframework.utils.JSUtils.Where where)
-
scrollToCenter
public void scrollToCenter(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement webElement, org.openqa.selenium.Point offset)Scrolls the element to the center of the viewport
-
mouseOver
public void mouseOver(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement webElement)
-
doubleClick
public void doubleClick(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement webElement)
-
rightClick
public void rightClick(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement webElement)
-
click
public void click(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement webElement)
-
clickAbsolute
public void clickAbsolute(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement webElement)
-
mouseOverAbsolute2Axis
public void mouseOverAbsolute2Axis(org.openqa.selenium.WebDriver webDriver, org.openqa.selenium.WebElement webElement)
-
-