类 JsActions
- java.lang.Object
-
- tech.testnx.cah.common.browser.actions.JsActions
-
- 所有已实现的接口:
HaveListener<ActionListener>,OperateBrowser
@Experimental public class JsActions extends Object implements OperateBrowser, HaveListener<ActionListener>
- 作者:
- Yun
-
-
构造器概要
构造器 构造器 说明 JsActions(org.openqa.selenium.WebDriver driver)JsActions(org.openqa.selenium.WebDriver driver, List<ActionListener> listeners)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidblur(org.openqa.selenium.WebElement e)Blur on an element by JSvoidcleanLocalStorages()Clean local storage of BrowservoidcleanSessionStorages()Clean session storage of BrowservoidclearResourcesPerformanceTiming()Clear resources performance timing for current pagevoidclick(org.openqa.selenium.WebElement e)Click an element by JSvoidcloseTab(String handleName)Close an active browser tab An active tab is working window by driver.switchTo().window The default window cannot be closed by the action After close the tab, then need swith another window by manualbooleanexitBrowserFullscreenMode()Exit browser full screen mode by JSvoidfocus(org.openqa.selenium.WebElement e)Focus on an element by JSvoidfocusWindow()Focus current windoworg.openqa.selenium.DimensiongetAvailableScreenDimension()Get available screen dimension except OS window taskbar at bottomorg.openqa.selenium.DimensiongetBrowserInnerDimension()Get window Inner dimension that is browser display zone / view port that includes scrollbar if haveorg.openqa.selenium.PointgetBrowserLocationOnScreen()Get entire browser window(outer) point to the top and left point of screenorg.openqa.selenium.DimensiongetBrowserOuterDimension()Get window outer dimension that include browser display zone, toolbar, scrollbarorg.openqa.selenium.DimensiongetBrowserViewPortDimension()Browser view port dimension without scrollbar(if have)org.openqa.selenium.PointgetBrowserViewPortLocationOnScreenInBrowserMaxMode()Location and Dimension of browser inner view port on Screenorg.openqa.selenium.PointgetCurrentScrollLocationOnPage()Return current scroll point in entire pageStringgetDocumentReadyState()Get page loading status Five values: uninitialized - Has not started loading yet loading - Is loading loaded - Has been loaded interactive - Has loaded enough and the user can interact with it complete - Fully loadedorg.openqa.selenium.DimensiongetDomPageDimension()Entire DOM page dimensionorg.openqa.selenium.DimensiongetElementDimension(org.openqa.selenium.WebElement e)get element dimension by JSorg.openqa.selenium.PointgetElementLocationOnPageToViewPort(org.openqa.selenium.WebElement e)get element location relative to the top and left corner of view port by JS if the element is not view port, it is still working.org.openqa.selenium.RectanglegetElementRectOnScreenInBrowserFullScreenMode(org.openqa.selenium.WebElement e)Element location and dimension on screen and scrolling into view automatically in browser Full Screen modeorg.openqa.selenium.RectanglegetElementRectOnScreenInBrowserMaxMode(org.openqa.selenium.WebElement e)Element location and dimension on screen and scrolling into view automatically in browser normal max modelonggetLocalStoragesLength()get local storage lengthStringgetLocalStorageValue(String key)get a local storage value by keycom.fasterxml.jackson.databind.JsonNodegetPagePerformance()Get all performance data for current pageorg.openqa.selenium.DimensiongetScreenDimension()Get real screen dimensionlonggetSessionStoragesLength()get session storage lengthStringgetSessionStorageValue(String key)get a session storage value by keyvoidhighlight(org.openqa.selenium.WebElement e)Highlight an element by JSbooleanisFullscreenMode()Check if it is full screen mode by JSTriplet<Boolean,Boolean,Long>isScrollbarVisible()voidnavigateTo(String url)Navigate to new URL by JSStringnewTab()Open a new browser tab and return a handle namevoidregisterListener(ActionListener listener)voidreload()Reload current page by JSvoidscrollBy(int x, int y)Scroll by relative point based on current scroll location by JSorg.openqa.selenium.PointscrollIntoView(org.openqa.selenium.WebElement e)Scroll element into view port and return the relative location to the top-left corner of view portvoidscrollTo(int x, int y)Scroll the window to a particular and definitely point(Top and Left offset) in the document by JSvoidscrollToBottom()Scroll to bottom by JSvoidscrollToTop()Scroll to top by JSvoidunregisterListener(ActionListener listener)
-
-
-
构造器详细资料
-
JsActions
public JsActions(org.openqa.selenium.WebDriver driver, List<ActionListener> listeners)
-
JsActions
public JsActions(org.openqa.selenium.WebDriver driver)
-
-
方法详细资料
-
registerListener
public void registerListener(ActionListener listener)
- 指定者:
registerListener在接口中HaveListener<ActionListener>
-
unregisterListener
public void unregisterListener(ActionListener listener)
- 指定者:
unregisterListener在接口中HaveListener<ActionListener>
-
click
public void click(org.openqa.selenium.WebElement e)
Click an element by JS
-
focus
public void focus(org.openqa.selenium.WebElement e)
Focus on an element by JS
-
blur
public void blur(org.openqa.selenium.WebElement e)
Blur on an element by JS
-
highlight
public void highlight(org.openqa.selenium.WebElement e)
Highlight an element by JS
-
scrollToTop
public void scrollToTop()
Scroll to top by JS
-
scrollToBottom
public void scrollToBottom()
Scroll to bottom by JS
-
scrollTo
public void scrollTo(int x, int y)Scroll the window to a particular and definitely point(Top and Left offset) in the document by JS
-
scrollBy
public void scrollBy(int x, int y)Scroll by relative point based on current scroll location by JS
-
scrollIntoView
public org.openqa.selenium.Point scrollIntoView(org.openqa.selenium.WebElement e)
Scroll element into view port and return the relative location to the top-left corner of view port
-
getElementRectOnScreenInBrowserMaxMode
public org.openqa.selenium.Rectangle getElementRectOnScreenInBrowserMaxMode(org.openqa.selenium.WebElement e)
Element location and dimension on screen and scrolling into view automatically in browser normal max mode
-
getElementRectOnScreenInBrowserFullScreenMode
public org.openqa.selenium.Rectangle getElementRectOnScreenInBrowserFullScreenMode(org.openqa.selenium.WebElement e)
Element location and dimension on screen and scrolling into view automatically in browser Full Screen mode
-
getElementDimension
public org.openqa.selenium.Dimension getElementDimension(org.openqa.selenium.WebElement e)
get element dimension by JS
-
getElementLocationOnPageToViewPort
public org.openqa.selenium.Point getElementLocationOnPageToViewPort(org.openqa.selenium.WebElement e)
get element location relative to the top and left corner of view port by JS if the element is not view port, it is still working. that means the location value is changing if scrolling this can be used in full screen mode by scrollIntoView(e) + getElementLocation(e)
-
getScreenDimension
public org.openqa.selenium.Dimension getScreenDimension()
Get real screen dimension
-
getAvailableScreenDimension
public org.openqa.selenium.Dimension getAvailableScreenDimension()
Get available screen dimension except OS window taskbar at bottom
-
getBrowserViewPortDimension
public org.openqa.selenium.Dimension getBrowserViewPortDimension()
Browser view port dimension without scrollbar(if have)
-
getBrowserInnerDimension
public org.openqa.selenium.Dimension getBrowserInnerDimension()
Get window Inner dimension that is browser display zone / view port that includes scrollbar if have
-
getBrowserOuterDimension
public org.openqa.selenium.Dimension getBrowserOuterDimension()
Get window outer dimension that include browser display zone, toolbar, scrollbar
-
getBrowserLocationOnScreen
public org.openqa.selenium.Point getBrowserLocationOnScreen()
Get entire browser window(outer) point to the top and left point of screen
-
getDomPageDimension
public org.openqa.selenium.Dimension getDomPageDimension()
Entire DOM page dimension
-
getCurrentScrollLocationOnPage
public org.openqa.selenium.Point getCurrentScrollLocationOnPage()
Return current scroll point in entire page
-
getBrowserViewPortLocationOnScreenInBrowserMaxMode
public org.openqa.selenium.Point getBrowserViewPortLocationOnScreenInBrowserMaxMode()
Location and Dimension of browser inner view port on Screen
-
isScrollbarVisible
public Triplet<Boolean,Boolean,Long> isScrollbarVisible()
- 返回:
- Triplet which includes vertical and horizontal scrollbars and scrollbar width
-
exitBrowserFullscreenMode
public boolean exitBrowserFullscreenMode()
Exit browser full screen mode by JS
-
isFullscreenMode
public boolean isFullscreenMode()
Check if it is full screen mode by JS
-
newTab
public String newTab()
Open a new browser tab and return a handle name
-
closeTab
public void closeTab(String handleName)
Close an active browser tab An active tab is working window by driver.switchTo().window The default window cannot be closed by the action After close the tab, then need swith another window by manual
-
focusWindow
public void focusWindow()
Focus current window
-
reload
public void reload()
Reload current page by JS
-
navigateTo
public void navigateTo(String url)
Navigate to new URL by JS
-
cleanLocalStorages
public void cleanLocalStorages()
Clean local storage of Browser
-
cleanSessionStorages
public void cleanSessionStorages()
Clean session storage of Browser
-
getLocalStoragesLength
public long getLocalStoragesLength()
get local storage length
-
getSessionStoragesLength
public long getSessionStoragesLength()
get session storage length
-
getLocalStorageValue
public String getLocalStorageValue(String key)
get a local storage value by key
-
getSessionStorageValue
public String getSessionStorageValue(String key)
get a session storage value by key
-
getDocumentReadyState
public String getDocumentReadyState()
Get page loading status Five values: uninitialized - Has not started loading yet loading - Is loading loaded - Has been loaded interactive - Has loaded enough and the user can interact with it complete - Fully loaded
-
getPagePerformance
public com.fasterxml.jackson.databind.JsonNode getPagePerformance()
Get all performance data for current page
-
clearResourcesPerformanceTiming
public void clearResourcesPerformanceTiming()
Clear resources performance timing for current page
-
-