Class SeleniumVirtualUser

    • Constructor Detail

      • SeleniumVirtualUser

        public SeleniumVirtualUser()
    • Method Detail

      • pre

        public void pre()
                 throws java.lang.Exception
        Description copied from class: VirtualUser
        This method is called before any scripts are executed.

        Override this method in your custom Virtual User if you have code which should be run only once, before any scripts are executed.

        This method initialises logging systems. If you override this method in a custom Virtual User, then a call to super.pre() must be made and must occur before any code that may cause an exception or write to a log.

        Overrides:
        pre in class VirtualUser
        Throws:
        java.lang.Exception - An error occurred
      • post

        protected void post()
                     throws java.lang.Exception
        Description copied from class: VirtualUser
        This method is called after all scripts have finished executing.

        Override this method in your custom Virtual User if you have code which should be run only once, after all scripts have finished executing.

        This method shuts down logging systems. If you override this method in a custom Virtual User, then a call to super.post() must be made at the end of the method. All exceptions thrown during the execution of this method must be caught and handled.

        Overrides:
        post in class VirtualUser
        Throws:
        java.lang.Exception - An error occurred
      • initialiseHtmlUnitDriver

        public void initialiseHtmlUnitDriver​(com.gargoylesoftware.htmlunit.BrowserVersion browserVersion)
                                      throws java.lang.Exception
        Description copied from interface: SeleniumVirtualUserInterface
        Create a new HtmlUnitDriver instance for this SeleniumVirtualUser, impersonating the BrowserVersion specified.

        Typically, this method is called from the VirtualUser.pre() method.

        Specified by:
        initialiseHtmlUnitDriver in interface SeleniumVirtualUserInterface
        Parameters:
        browserVersion - The BrowserVersion to impersonate.
        Throws:
        java.lang.Exception - An error occurred
      • initialiseInternetExplorerDriver

        public void initialiseInternetExplorerDriver​(java.lang.String pathToIEDriverServer)
                                              throws java.lang.Exception
        Description copied from interface: SeleniumVirtualUserInterface
        Create a new InternetExplorerDriver instance for this SeleniumVirtualUser.

        In order to use the InternetExplorerDriver, you need to install the IE driver server (IEDriverServer.exe) on each injector in your test. You must then pass the full path of the driver server to this method, e.g:

        
         initialiseInternetExplorerDriver("C:/tools/SeleniumDrivers/IEDriverServer.exe");
         
        For more information on setting up the IE driver server, please refer to the documentation on the selenium website.

        Typically, this method is called from the VirtualUser.pre() method.

        Specified by:
        initialiseInternetExplorerDriver in interface SeleniumVirtualUserInterface
        Parameters:
        pathToIEDriverServer - The full path to the IE driver server on the injector.
        Throws:
        java.lang.Exception - An error occurred
      • initialiseChromeDriver

        public void initialiseChromeDriver​(java.lang.String pathToChromeDriver)
                                    throws java.lang.Exception
        Description copied from interface: SeleniumVirtualUserInterface
        Create a new ChromeDriver instance for this SeleniumVirtualUser.

        In order to use the ChromeDriver, you need to install the chrome driver server (chromedriver.exe) on each injector in your test. You must then pass the full path of the driver server to this method, e.g:

        
         initialiseChromeDriver("C:/tools/SeleniumDrivers/chromedriver.exe");
         
        For more information on setting up the chrome driver server, please refer to the documentation on the selenium website.

        Typically, this method is called from the VirtualUser.pre() method.

        Specified by:
        initialiseChromeDriver in interface SeleniumVirtualUserInterface
        Parameters:
        pathToChromeDriver - The full path to the chrome driver server on the injector.
        Throws:
        java.lang.Exception - An error occurred
      • initialisePhantomJSDriver

        public void initialisePhantomJSDriver​(java.lang.String pathToPhantomJSExe)
                                       throws java.lang.Exception
        Description copied from interface: SeleniumVirtualUserInterface
        Create a new PhantomJSDriver instance for this SeleniumVirtualUser.

        In order to use the PhantomJSDriver, you need to install the PhantomJS on each injector in your test. You must then pass the full path of phantomjs.exe to this method, e.g:

        
         initialisePhantomJSDriver("C:/tools/phantomjs-1.9.7-windows/phantomjs.exe");
         
        For more information on PhantomJS, please refer to the PhantomJS website.

        Typically, this method is called from the VirtualUser.pre() method.

        Specified by:
        initialisePhantomJSDriver in interface SeleniumVirtualUserInterface
        Parameters:
        pathToPhantomJSExe - The full path of phantomjs.exe
        Throws:
        java.lang.Exception - An error occurred
      • initialiseWebDriver

        public void initialiseWebDriver​(WebDriverType driverType)
                                 throws java.lang.Exception
        Description copied from interface: SeleniumVirtualUserInterface
        Create a new WebDriver instance for this SeleniumVirtualUser.

        This method provides a way to alter the type of WebDriver for this Virtual User. Valid driver types are as follows:

        • HtmlUnit
        • FireFox
        • Chrome
        • InternetExplorer
        • PhantomJS

        e.g.

        
         // Create a new FirefoxDriver for this Virtual User 
         initialiseWebDriver(WebDriverType.FireFox);
         
        Specified by:
        initialiseWebDriver in interface SeleniumVirtualUserInterface
        Parameters:
        driverType - The web driver type to create
        Throws:
        java.lang.Exception - An error occurred