Class XltDriver

  • All Implemented Interfaces:
    HasCapabilities, Interactive, JavascriptExecutor, SearchContext, WebDriver

    public final class XltDriver
    extends com.xceptance.xlt.engine.xltdriver.HtmlUnitDriver
    Extended version of HtmlUnitDriver which just uses the XLT web client. XltDriver can act as a full replacement for the HtmlUnitDriver and offers additional capabilities which are important for load testing.

    This class is final to avoid changes to the web client which would render the XLT functionality obsolete.

    • Field Summary

      • Fields inherited from class com.xceptance.xlt.engine.xltdriver.HtmlUnitDriver

        BROWSER_LANGUAGE_CAPABILITY, DOWNLOAD_IMAGES_CAPABILITY, JAVASCRIPT_ENABLED
    • Constructor Summary

      Constructors 
      Constructor Description
      XltDriver()
      Constructs a new instance.
      XltDriver​(boolean enableJavaScript)
      Constructs a new instance with the specified JavaScript support.
      XltDriver​(BrowserVersion version)
      Constructs a new instance with the specified browser version.
      XltDriver​(BrowserVersion version, boolean enableJavaScript)
      Constructs a new instance with the specified browser version and JavaScript support.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      WebElement findElement​(By by)
      java.util.List<WebElement> findElements​(By by)
      void get​(java.lang.String url)
      java.lang.String getCurrentUrl()
      java.lang.String getPageSource()
      java.lang.String getTitle()
      WebClient getWebClient()
      Returns the underlying WebClient instance to work with it directly.
      java.lang.String getWindowHandle()
      java.util.Set<java.lang.String> getWindowHandles()
      WebDriver.Options manage()
      WebDriver.Navigation navigate()
      protected WebClient newWebClient​(BrowserVersion version)
      Returns a new web client instance to be used by this driver.
      void quit()
      • Methods inherited from class com.xceptance.xlt.engine.xltdriver.HtmlUnitDriver

        assertElementNotStale, click, doubleClick, executeAsyncScript, executeScript, findElement, findElements, get, getAlert, getBrowserVersion, getCapabilities, getCurrentWindow, getElementsMap, getKeyboard, getMouse, implicitlyWaitFor, isAcceptInsecureCerts, isDownloadImages, isJavascriptEnabled, modifyWebClient, mouseDown, mouseMove, mouseUp, openNewWindow, perform, resetInputState, runAsync, sendKeys, setAcceptInsecureCerts, setAutoProxy, setCurrentWindow, setDownloadImages, setExecutor, setHTTPProxy, setJavascriptEnabled, setProxy, setProxySettings, setSocksProxy, setSocksProxy, submit, switchTo, switchToDefaultContentOfWindow, toWebElement
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XltDriver

        public XltDriver()
        Constructs a new instance. What browser version will be used and whether JavaScript will be enabled is configured in the XLT settings.
      • XltDriver

        public XltDriver​(boolean enableJavaScript)
        Constructs a new instance with the specified JavaScript support. What browser version will be used is configured in the XLT settings.
        Parameters:
        enableJavaScript - whether to enable JavaScript support or not
      • XltDriver

        public XltDriver​(BrowserVersion version)
        Constructs a new instance with the specified browser version. Whether JavaScript will be enabled is configured in the XLT settings.
        Parameters:
        version - the browser version to use
      • XltDriver

        public XltDriver​(BrowserVersion version,
                         boolean enableJavaScript)
        Constructs a new instance with the specified browser version and JavaScript support.
        Parameters:
        version - the browser version to use
        enableJavaScript - whether to enable JavaScript support or not
    • Method Detail

      • newWebClient

        protected WebClient newWebClient​(BrowserVersion version)
        Returns a new web client instance to be used by this driver. Overwritten to return an enhanced XLT web client instead of HtmlUnit's web client.
        Overrides:
        newWebClient in class com.xceptance.xlt.engine.xltdriver.HtmlUnitDriver
        Parameters:
        version - which browser to emulate
        Returns:
        the web client
      • getWebClient

        public WebClient getWebClient()
        Returns the underlying WebClient instance to work with it directly. Mostly used for testing purposes of the framework itself.
        Overrides:
        getWebClient in class com.xceptance.xlt.engine.xltdriver.HtmlUnitDriver
        Returns:
        the web client
      • quit

        public void quit()
        Specified by:
        quit in interface WebDriver
        Overrides:
        quit in class com.xceptance.xlt.engine.xltdriver.HtmlUnitDriver
      • manage

        public WebDriver.Options manage()
        Specified by:
        manage in interface WebDriver
        Overrides:
        manage in class com.xceptance.xlt.engine.xltdriver.HtmlUnitDriver
      • close

        public void close()
        Specified by:
        close in interface WebDriver
        Overrides:
        close in class com.xceptance.xlt.engine.xltdriver.HtmlUnitDriver
      • getPageSource

        public java.lang.String getPageSource()
        Specified by:
        getPageSource in interface WebDriver
        Overrides:
        getPageSource in class com.xceptance.xlt.engine.xltdriver.HtmlUnitDriver
      • getWindowHandle

        public java.lang.String getWindowHandle()
        Specified by:
        getWindowHandle in interface WebDriver
        Overrides:
        getWindowHandle in class com.xceptance.xlt.engine.xltdriver.HtmlUnitDriver
      • getWindowHandles

        public java.util.Set<java.lang.String> getWindowHandles()
        Specified by:
        getWindowHandles in interface WebDriver
        Overrides:
        getWindowHandles in class com.xceptance.xlt.engine.xltdriver.HtmlUnitDriver
      • getCurrentUrl

        public java.lang.String getCurrentUrl()
        Specified by:
        getCurrentUrl in interface WebDriver
        Overrides:
        getCurrentUrl in class com.xceptance.xlt.engine.xltdriver.HtmlUnitDriver
      • get

        public void get​(java.lang.String url)
        Specified by:
        get in interface WebDriver
        Overrides:
        get in class com.xceptance.xlt.engine.xltdriver.HtmlUnitDriver
      • getTitle

        public java.lang.String getTitle()
        Specified by:
        getTitle in interface WebDriver
        Overrides:
        getTitle in class com.xceptance.xlt.engine.xltdriver.HtmlUnitDriver