Class VerisoftDriver
- All Implemented Interfaces:
org.openqa.selenium.HasCapabilities
,org.openqa.selenium.interactions.Interactive
,org.openqa.selenium.JavascriptExecutor
,org.openqa.selenium.PrintsPage
,org.openqa.selenium.SearchContext
,org.openqa.selenium.TakesScreenshot
,org.openqa.selenium.virtualauthenticator.HasVirtualAuthenticator
,org.openqa.selenium.WebDriver
,org.openqa.selenium.WrapsDriver
- Direct Known Subclasses:
VerisoftMobileDriver
1. Local and Remote
2. All Apppium and Selenium based drivers (Web and mobile are currently supported)
VeriSoft driver is a concrete class which implements a variety of interfaces (which makes it easier not having to
perform castings on many operations).
I supports local creation of local WebDriver objects using WebDriverManager package (see more about WebDriverManager
at WebDriverManager Github Repository )
It also supports creation of remote WebDriver objects using the built-in Selenium mechanism. VeriSoftDriver follows
the RemoteWebDriver.java architecture, and actually stores an instance of RemoteWebDriver in it.
VerisoftDriver implements the WebDriver behavior, and in addition, it also adds some functionality. The main additional functionalities which
are currently supported:
1. Async operations. See async operation in the "See Also" section
2. Extended logging
3. All available events included within the Selenium framework are registered. See events in the "See Also"
section
4. WebDriver is wrapped with EventFiringDecorator. See in the "See Also" section
The driver is instanciated by specifying the relevant DesiredCapabilities, and if the driver is a remote driver,
specifying remote url. All of VeriSoft's ctors expectes at least
a DesiredCapabilities object.
All other inner WebDriver class are also implemented as delegate classes.
TODO Add support to client-server drives e.g WinAppDriver and Winium
TODO Add additional drivers support such as dockers (see Selenium-Jupiter for a list of supported drivers)
TODO Find ways to add unit tests to this class (it is heavily dependened on OS, external SW etc.). Maybe dockers?
Example 1 - Creating a local VerisoftDriver with firefox as driver:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("browserName", "firefox");
WebDriver driver = new VerisoftDriver(capabilities);
driver.get("http://www.google.com");
String title = driver.getTitle();
if (title == "Google")
System.out.println("We are in Google homepage");
driver.close();
Example 2 - Creating a remote VerisoftDriver with safari as driver:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("browserName", "safari");
WebDriver driver = new VerisoftDriver("http://remote-url-address:port", capabilities);
driver.get("http://www.google.com");
String title = driver.getTitle();
if (title == "Google")
System.out.println("We are in Google homepage");
driver.close();
- Since:
- 1.9.6
- Author:
- Nir Gallner @ www.VeriSoft.co
- See Also:
-
RemoteWebDriver
AsyncTask
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
protected class
Nested classes/interfaces inherited from interface org.openqa.selenium.WebDriver
org.openqa.selenium.WebDriver.Navigation, org.openqa.selenium.WebDriver.Options, org.openqa.selenium.WebDriver.TargetLocator, org.openqa.selenium.WebDriver.Timeouts, org.openqa.selenium.WebDriver.Window
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionVerisoftDriver
(@Nullable URL remoteAddress, org.openqa.selenium.Capabilities capabilities) C-tor for local and remote driversVerisoftDriver
(URL url, org.openqa.selenium.Capabilities capabilities, Map<String, String> customHeaders) VerisoftDriver
(org.openqa.selenium.Capabilities capabilities) VerisoftDriver
(org.openqa.selenium.remote.HttpCommandExecutor commandExecutor, org.openqa.selenium.Capabilities capabilities) VerisoftDriver
(org.openqa.selenium.WebDriver otherDriver) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(@NotNull org.openqa.selenium.support.events.WebDriverListener listener) org.openqa.selenium.virtualauthenticator.VirtualAuthenticator
addVirtualAuthenticator
(org.openqa.selenium.virtualauthenticator.VirtualAuthenticatorOptions options) async()
Retrieves the Async listener.void
close()
executeAsyncScript
(String script, Object... args) executeScript
(String script, Object... args) executeScript
(org.openqa.selenium.ScriptKey key, Object... args) org.openqa.selenium.WebElement
findElement
(org.openqa.selenium.By by) List<org.openqa.selenium.WebElement>
findElements
(org.openqa.selenium.By by) void
org.openqa.selenium.Capabilities
Set<org.openqa.selenium.ScriptKey>
<X> X
getScreenshotAs
(org.openqa.selenium.OutputType<X> target) getTitle()
org.openqa.selenium.WebDriver
org.openqa.selenium.WebDriver.Options
manage()
org.openqa.selenium.WebDriver.Navigation
navigate()
void
perform
(Collection<org.openqa.selenium.interactions.Sequence> actions) org.openqa.selenium.ScriptKey
org.openqa.selenium.Pdf
print
(org.openqa.selenium.print.PrintOptions printOptions) void
quit()
void
removeVirtualAuthenticator
(org.openqa.selenium.virtualauthenticator.VirtualAuthenticator authenticator) void
org.openqa.selenium.WebDriver.TargetLocator
switchTo()
void
unpin
(org.openqa.selenium.ScriptKey key)
-
Field Details
-
driver
protected org.openqa.selenium.WebDriver driver
-
-
Constructor Details
-
VerisoftDriver
public VerisoftDriver(org.openqa.selenium.Capabilities capabilities) -
VerisoftDriver
-
VerisoftDriver
public VerisoftDriver(@Nullable @Nullable URL remoteAddress, org.openqa.selenium.Capabilities capabilities) C-tor for local and remote drivers- Parameters:
remoteAddress
- address of the remote Selenium servercapabilities
- capabilities object
-
VerisoftDriver
public VerisoftDriver(org.openqa.selenium.remote.HttpCommandExecutor commandExecutor, org.openqa.selenium.Capabilities capabilities) -
VerisoftDriver
public VerisoftDriver(org.openqa.selenium.WebDriver otherDriver)
-
-
Method Details
-
addListener
public void addListener(@NotNull @NotNull org.openqa.selenium.support.events.WebDriverListener listener) -
get
- Specified by:
get
in interfaceorg.openqa.selenium.WebDriver
-
getCurrentUrl
- Specified by:
getCurrentUrl
in interfaceorg.openqa.selenium.WebDriver
-
getTitle
- Specified by:
getTitle
in interfaceorg.openqa.selenium.WebDriver
-
findElements
- Specified by:
findElements
in interfaceorg.openqa.selenium.SearchContext
- Specified by:
findElements
in interfaceorg.openqa.selenium.WebDriver
-
findElement
public org.openqa.selenium.WebElement findElement(org.openqa.selenium.By by) - Specified by:
findElement
in interfaceorg.openqa.selenium.SearchContext
- Specified by:
findElement
in interfaceorg.openqa.selenium.WebDriver
-
getPageSource
- Specified by:
getPageSource
in interfaceorg.openqa.selenium.WebDriver
-
close
public void close()- Specified by:
close
in interfaceorg.openqa.selenium.WebDriver
-
quit
public void quit()- Specified by:
quit
in interfaceorg.openqa.selenium.WebDriver
-
getWindowHandles
- Specified by:
getWindowHandles
in interfaceorg.openqa.selenium.WebDriver
-
getWindowHandle
- Specified by:
getWindowHandle
in interfaceorg.openqa.selenium.WebDriver
-
switchTo
public org.openqa.selenium.WebDriver.TargetLocator switchTo()- Specified by:
switchTo
in interfaceorg.openqa.selenium.WebDriver
-
manage
public org.openqa.selenium.WebDriver.Options manage()- Specified by:
manage
in interfaceorg.openqa.selenium.WebDriver
-
executeScript
- Specified by:
executeScript
in interfaceorg.openqa.selenium.JavascriptExecutor
-
executeAsyncScript
- Specified by:
executeAsyncScript
in interfaceorg.openqa.selenium.JavascriptExecutor
-
pin
- Specified by:
pin
in interfaceorg.openqa.selenium.JavascriptExecutor
-
unpin
public void unpin(org.openqa.selenium.ScriptKey key) - Specified by:
unpin
in interfaceorg.openqa.selenium.JavascriptExecutor
-
getPinnedScripts
- Specified by:
getPinnedScripts
in interfaceorg.openqa.selenium.JavascriptExecutor
-
executeScript
- Specified by:
executeScript
in interfaceorg.openqa.selenium.JavascriptExecutor
-
getCapabilities
public org.openqa.selenium.Capabilities getCapabilities()- Specified by:
getCapabilities
in interfaceorg.openqa.selenium.HasCapabilities
-
addVirtualAuthenticator
public org.openqa.selenium.virtualauthenticator.VirtualAuthenticator addVirtualAuthenticator(org.openqa.selenium.virtualauthenticator.VirtualAuthenticatorOptions options) - Specified by:
addVirtualAuthenticator
in interfaceorg.openqa.selenium.virtualauthenticator.HasVirtualAuthenticator
-
removeVirtualAuthenticator
public void removeVirtualAuthenticator(org.openqa.selenium.virtualauthenticator.VirtualAuthenticator authenticator) - Specified by:
removeVirtualAuthenticator
in interfaceorg.openqa.selenium.virtualauthenticator.HasVirtualAuthenticator
-
perform
- Specified by:
perform
in interfaceorg.openqa.selenium.interactions.Interactive
-
resetInputState
public void resetInputState()- Specified by:
resetInputState
in interfaceorg.openqa.selenium.interactions.Interactive
-
print
public org.openqa.selenium.Pdf print(org.openqa.selenium.print.PrintOptions printOptions) throws org.openqa.selenium.WebDriverException - Specified by:
print
in interfaceorg.openqa.selenium.PrintsPage
- Throws:
org.openqa.selenium.WebDriverException
-
getScreenshotAs
public <X> X getScreenshotAs(org.openqa.selenium.OutputType<X> target) throws org.openqa.selenium.WebDriverException - Specified by:
getScreenshotAs
in interfaceorg.openqa.selenium.TakesScreenshot
- Throws:
org.openqa.selenium.WebDriverException
-
getWrappedDriver
public org.openqa.selenium.WebDriver getWrappedDriver()- Specified by:
getWrappedDriver
in interfaceorg.openqa.selenium.WrapsDriver
-
async
Retrieves the Async listener. If it is not initialized yet, initializes the listener- Returns:
- AsyncListener object
-