类 JsActions

    • 构造器详细资料

      • JsActions

        public JsActions​(org.openqa.selenium.WebDriver driver,
                         List<ActionListener> listeners)
      • JsActions

        public JsActions​(org.openqa.selenium.WebDriver driver)
    • 方法详细资料

      • 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