Interface SeleniumVirtualUserInterface
-
- All Known Implementing Classes:
SeleniumVirtualUser,SeleniumVirtualUserScript
public interface SeleniumVirtualUserInterfaceDescribes the methods that can be called in anSeleniumVirtualUserScriptor customSeleniumVirtualUser.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description JavascriptExecutorgetJavascriptExecutor()Get aJavascriptExecutorfor thisSeleniumVirtualUserWebDrivergetUnderlyingWebDriver()Get the underlyingWebDriverinstance for thisSeleniumVirtualUser.WebDrivergetWebDriver()Get theWebDriverinstance for thisSeleniumVirtualUser.voidinitialiseChromeDriver(java.lang.String pathToChromeDriver)Create a newChromeDriverinstance for thisSeleniumVirtualUser.voidinitialiseFirefoxDriver()Create a newFirefoxDriverinstance for thisSeleniumVirtualUser.voidinitialiseHtmlUnitDriver()Create a newHtmlUnitDriverinstance for thisSeleniumVirtualUser.voidinitialiseHtmlUnitDriver(com.gargoylesoftware.htmlunit.BrowserVersion browserVersion)Create a newHtmlUnitDriverinstance for thisSeleniumVirtualUser, impersonating theBrowserVersionspecified.voidinitialiseInternetExplorerDriver(java.lang.String pathToIEDriverServer)Create a newInternetExplorerDriverinstance for thisSeleniumVirtualUser.voidinitialisePhantomJSDriver(java.lang.String pathToPhantomJSExe)Create a newPhantomJSDriverinstance for thisSeleniumVirtualUser.voidinitialiseWebDriver(WebDriverType driverType)Deprecated.As of release 5.3, the preferred method to change the type ofWebDriveris to call one of:initialiseHtmlUnitDriver()initialiseFirefoxDriver()initialiseChromeDriver(String)initialiseInternetExplorerDriver(String)initialisePhantomJSDriver(String)initialiseWebDriver(org.openqa.selenium.WebDriver)voidinitialiseWebDriver(WebDriver driver)Create a newWebDriverinstance for thisSeleniumVirtualUser.
-
-
-
Method Detail
-
getWebDriver
WebDriver getWebDriver()
Get theWebDriverinstance for thisSeleniumVirtualUser.- Returns:
- The
WebDriverinstance for thisSeleniumVirtualUser.
-
getJavascriptExecutor
JavascriptExecutor getJavascriptExecutor()
Get aJavascriptExecutorfor thisSeleniumVirtualUser- Returns:
- A
JavascriptExecutorfor thisSeleniumVirtualUser
-
initialiseWebDriver
@Deprecated void initialiseWebDriver(WebDriverType driverType) throws java.lang.Exception
Deprecated.As of release 5.3, the preferred method to change the type ofWebDriveris to call one of:Create a newWebDriverinstance for thisSeleniumVirtualUser.This method provides a way to alter the type of
WebDriverfor 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);- Parameters:
driverType- The web driver type to create- Throws:
java.lang.Exception- An error occurred
-
initialiseWebDriver
void initialiseWebDriver(WebDriver driver) throws java.lang.Exception
Create a newWebDriverinstance for thisSeleniumVirtualUser.This method provides a way to alter the type of
WebDriverfor this Virtual User.- Parameters:
driver- The type ofWebDriverto be used by this Virtual User- Throws:
java.lang.Exception- An error occurred
-
initialiseHtmlUnitDriver
void initialiseHtmlUnitDriver() throws java.lang.ExceptionCreate a newHtmlUnitDriverinstance for thisSeleniumVirtualUser.The
HtmlUnitDriverwill be set to use the defaultBrowserVersion. If you need to impersonate a differentBrowserVersionthen you can callinitialiseHtmlUnitDriver(BrowserVersion)instead.Typically, this method is called from the
VirtualUser.pre()method.- Throws:
java.lang.Exception- An error occurred
-
initialiseHtmlUnitDriver
void initialiseHtmlUnitDriver(com.gargoylesoftware.htmlunit.BrowserVersion browserVersion) throws java.lang.ExceptionCreate a newHtmlUnitDriverinstance for thisSeleniumVirtualUser, impersonating theBrowserVersionspecified.Typically, this method is called from the
VirtualUser.pre()method.- Parameters:
browserVersion- TheBrowserVersionto impersonate.- Throws:
java.lang.Exception- An error occurred
-
initialiseFirefoxDriver
void initialiseFirefoxDriver() throws java.lang.ExceptionCreate a newFirefoxDriverinstance for thisSeleniumVirtualUser.Typically, this method is called from the
VirtualUser.pre()method.- Throws:
java.lang.Exception- An error occurred
-
initialiseInternetExplorerDriver
void initialiseInternetExplorerDriver(java.lang.String pathToIEDriverServer) throws java.lang.ExceptionCreate a newInternetExplorerDriverinstance for thisSeleniumVirtualUser.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:
For more information on setting up the IE driver server, please refer to the documentation on the selenium website.initialiseInternetExplorerDriver("C:/tools/SeleniumDrivers/IEDriverServer.exe");Typically, this method is called from the
VirtualUser.pre()method.- Parameters:
pathToIEDriverServer- The full path to the IE driver server on the injector.- Throws:
java.lang.Exception- An error occurred
-
initialiseChromeDriver
void initialiseChromeDriver(java.lang.String pathToChromeDriver) throws java.lang.ExceptionCreate a newChromeDriverinstance for thisSeleniumVirtualUser.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:
For more information on setting up the chrome driver server, please refer to the documentation on the selenium website.initialiseChromeDriver("C:/tools/SeleniumDrivers/chromedriver.exe");Typically, this method is called from the
VirtualUser.pre()method.- Parameters:
pathToChromeDriver- The full path to the chrome driver server on the injector.- Throws:
java.lang.Exception- An error occurred
-
initialisePhantomJSDriver
void initialisePhantomJSDriver(java.lang.String pathToPhantomJSExe) throws java.lang.ExceptionCreate a newPhantomJSDriverinstance for thisSeleniumVirtualUser.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 ofphantomjs.exeto this method, e.g:
For more information on PhantomJS, please refer to the PhantomJS website.initialisePhantomJSDriver("C:/tools/phantomjs-1.9.7-windows/phantomjs.exe");Typically, this method is called from the
VirtualUser.pre()method.- Parameters:
pathToPhantomJSExe- The full path ofphantomjs.exe- Throws:
java.lang.Exception- An error occurred
-
getUnderlyingWebDriver
WebDriver getUnderlyingWebDriver()
Get the underlyingWebDriverinstance for thisSeleniumVirtualUser.This is useful if you need to call a method that is specific to the
WebDrivertype that you are using. For example, if you are using theHtmlUnitDriver, you could use this method to call thesetJavascriptEnabledmethod:HtmlUnitDriver htmlUnitDriver = (HtmlUnitDriver)getUnderlyingWebDriver(); htmlUnitDriver.setJavascriptEnabled(false);- Returns:
- The underlying
WebDriverinstance for thisSeleniumVirtualUser.
-
-