Interface SeleniumVirtualUserInterface
-
- All Known Implementing Classes:
SeleniumVirtualUser
,SeleniumVirtualUserScript
public interface SeleniumVirtualUserInterface
Describes the methods that can be called in anSeleniumVirtualUserScript
or customSeleniumVirtualUser
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description JavascriptExecutor
getJavascriptExecutor()
Get aJavascriptExecutor
for thisSeleniumVirtualUser
WebDriver
getUnderlyingWebDriver()
Get the underlyingWebDriver
instance for thisSeleniumVirtualUser
.WebDriver
getWebDriver()
Get theWebDriver
instance for thisSeleniumVirtualUser
.void
initialiseChromeDriver(java.lang.String pathToChromeDriver)
Create a newChromeDriver
instance for thisSeleniumVirtualUser
.void
initialiseFirefoxDriver()
Create a newFirefoxDriver
instance for thisSeleniumVirtualUser
.void
initialiseHtmlUnitDriver()
Create a newHtmlUnitDriver
instance for thisSeleniumVirtualUser
.void
initialiseHtmlUnitDriver(com.gargoylesoftware.htmlunit.BrowserVersion browserVersion)
Create a newHtmlUnitDriver
instance for thisSeleniumVirtualUser
, impersonating theBrowserVersion
specified.void
initialiseInternetExplorerDriver(java.lang.String pathToIEDriverServer)
Create a newInternetExplorerDriver
instance for thisSeleniumVirtualUser
.void
initialisePhantomJSDriver(java.lang.String pathToPhantomJSExe)
Create a newPhantomJSDriver
instance for thisSeleniumVirtualUser
.void
initialiseWebDriver(WebDriverType driverType)
Deprecated.As of release 5.3, the preferred method to change the type ofWebDriver
is to call one of:initialiseHtmlUnitDriver()
initialiseFirefoxDriver()
initialiseChromeDriver(String)
initialiseInternetExplorerDriver(String)
initialisePhantomJSDriver(String)
initialiseWebDriver(org.openqa.selenium.WebDriver)
void
initialiseWebDriver(WebDriver driver)
Create a newWebDriver
instance for thisSeleniumVirtualUser
.
-
-
-
Method Detail
-
getWebDriver
WebDriver getWebDriver()
Get theWebDriver
instance for thisSeleniumVirtualUser
.- Returns:
- The
WebDriver
instance for thisSeleniumVirtualUser
.
-
getJavascriptExecutor
JavascriptExecutor getJavascriptExecutor()
Get aJavascriptExecutor
for thisSeleniumVirtualUser
- Returns:
- A
JavascriptExecutor
for thisSeleniumVirtualUser
-
initialiseWebDriver
@Deprecated void initialiseWebDriver(WebDriverType driverType) throws java.lang.Exception
Deprecated.As of release 5.3, the preferred method to change the type ofWebDriver
is to call one of:Create a newWebDriver
instance for thisSeleniumVirtualUser
.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);
- 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 newWebDriver
instance for thisSeleniumVirtualUser
.This method provides a way to alter the type of
WebDriver
for this Virtual User.- Parameters:
driver
- The type ofWebDriver
to be used by this Virtual User- Throws:
java.lang.Exception
- An error occurred
-
initialiseHtmlUnitDriver
void initialiseHtmlUnitDriver() throws java.lang.Exception
Create a newHtmlUnitDriver
instance for thisSeleniumVirtualUser
.The
HtmlUnitDriver
will be set to use the defaultBrowserVersion
. If you need to impersonate a differentBrowserVersion
then 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.Exception
Create a newHtmlUnitDriver
instance for thisSeleniumVirtualUser
, impersonating theBrowserVersion
specified.Typically, this method is called from the
VirtualUser.pre()
method.- Parameters:
browserVersion
- TheBrowserVersion
to impersonate.- Throws:
java.lang.Exception
- An error occurred
-
initialiseFirefoxDriver
void initialiseFirefoxDriver() throws java.lang.Exception
Create a newFirefoxDriver
instance 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.Exception
Create a newInternetExplorerDriver
instance 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.Exception
Create a newChromeDriver
instance 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.Exception
Create a newPhantomJSDriver
instance 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.exe
to 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 underlyingWebDriver
instance for thisSeleniumVirtualUser
.This is useful if you need to call a method that is specific to the
WebDriver
type that you are using. For example, if you are using theHtmlUnitDriver
, you could use this method to call thesetJavascriptEnabled
method:HtmlUnitDriver htmlUnitDriver = (HtmlUnitDriver)getUnderlyingWebDriver(); htmlUnitDriver.setJavascriptEnabled(false);
- Returns:
- The underlying
WebDriver
instance for thisSeleniumVirtualUser
.
-
-