|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.openqa.selenium.remote.RemoteWebDriver org.openqa.selenium.phantomjs.PhantomJSDriver
public class PhantomJSDriver
A WebDriver
implementation that controls a PhantomJS running in Remote WebDriver mode.
This class is provided as a convenience for easily testing PhantomJS.
The control server which each instance communicates with will live and die with the instance.
PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY
PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY
PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY
is required only if the executable
phantomjs
is not available through the $PATH
environment variable:
you can provide it either via the Capabilities
construction parameter object,
or via System
Property.
PhantomJSDriverService.PHANTOMJS_GHOSTDRIVER_PATH_PROPERTY
is optional in case you want to use a specific
version of GhostDriver (i.e. during development of GhostDriver).
You can provide it either via the Capabilities
construction parameter object,
or via System
Property.
Instead, if you have a PhantomJS WebDriver process already running, you can instead use RemoteWebDriver.RemoteWebDriver(java.net.URL, org.openqa.selenium.Capabilities)
to delegate the
execution of your WebDriver/Selenium scripts to it. Of course, in that case you will than be in
charge to control the life-cycle of the PhantomJS process.
NOTE: PhantomJS Remote WebDriver mode is implemented via
GhostDriver.
It's a separate project that, at every stable release, is merged into PhantomJS.
If interested in developing (contributing to) GhostDriver, it's possible to run PhantomJS and pass GhostDriver as
a script.
NOTE: The design of this class is heavily inspired by org.openqa.selenium.chrome.ChromeDriver
.
PhantomJSDriverService.createDefaultService()
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.openqa.selenium.remote.RemoteWebDriver |
---|
org.openqa.selenium.remote.RemoteWebDriver.RemoteTargetLocator, org.openqa.selenium.remote.RemoteWebDriver.RemoteWebDriverOptions, org.openqa.selenium.remote.RemoteWebDriver.When |
Nested classes/interfaces inherited from interface org.openqa.selenium.WebDriver |
---|
org.openqa.selenium.WebDriver.ImeHandler, 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 |
Constructor Summary | |
---|---|
PhantomJSDriver()
Creates a new PhantomJSDriver instance. |
|
PhantomJSDriver(org.openqa.selenium.Capabilities desiredCapabilities)
Creates a new PhantomJSDriver instance. |
|
PhantomJSDriver(PhantomJSDriverService service,
org.openqa.selenium.Capabilities desiredCapabilities)
Creates a new PhantomJSDriver instance. |
Method Summary | ||
---|---|---|
java.lang.Object |
executePhantomJS(java.lang.String script,
java.lang.Object... args)
Execute a PhantomJS fragment. |
|
protected static java.util.Map<java.lang.String,org.openqa.selenium.remote.CommandInfo> |
getCustomCommands()
|
|
|
getScreenshotAs(org.openqa.selenium.OutputType<X> target)
Take screenshot of the current window. |
Methods inherited from class org.openqa.selenium.remote.RemoteWebDriver |
---|
close, execute, execute, executeAsyncScript, executeScript, findElement, findElement, findElementByClassName, findElementByCssSelector, findElementById, findElementByLinkText, findElementByName, findElementByPartialLinkText, findElementByTagName, findElementByXPath, findElements, findElements, findElementsByClassName, findElementsByCssSelector, findElementsById, findElementsByLinkText, findElementsByName, findElementsByPartialLinkText, findElementsByTagName, findElementsByXPath, get, getCapabilities, getCommandExecutor, getCurrentUrl, getElementConverter, getErrorHandler, getExecuteMethod, getFileDetector, getKeyboard, getMouse, getPageSource, getRemoteStatus, getSessionId, getTitle, getWindowHandle, getWindowHandles, log, manage, navigate, quit, setCommandExecutor, setElementConverter, setFileDetector, setFoundBy, setLogLevel, setSessionId, startClient, startSession, startSession, stopClient, switchTo, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PhantomJSDriver()
for configuration details.
public PhantomJSDriver(org.openqa.selenium.Capabilities desiredCapabilities)
desiredCapabilities
- The capabilities required from PhantomJS/GhostDriver.for configuration details.
public PhantomJSDriver(PhantomJSDriverService service, org.openqa.selenium.Capabilities desiredCapabilities)
service
will be started along with the
driver, and shutdown upon calling RemoteWebDriver.quit()
.
service
- The service to use.desiredCapabilities
- The capabilities required from PhantomJS/GhostDriver.Method Detail |
---|
public <X> X getScreenshotAs(org.openqa.selenium.OutputType<X> target) throws org.openqa.selenium.WebDriverException
getScreenshotAs
in interface org.openqa.selenium.TakesScreenshot
getScreenshotAs
in class org.openqa.selenium.remote.RemoteWebDriver
target
- The target type/format of the Screenshot
org.openqa.selenium.WebDriverException
TakesScreenshot.getScreenshotAs(org.openqa.selenium.OutputType)
public java.lang.Object executePhantomJS(java.lang.String script, java.lang.Object... args)
script
- The fragment of PhantomJS JavaScript to execute.args
- List of arguments to pass to the function that the script is wrapped in.
These can accessed in the script as 'arguments[0]', 'arguments[1]',
'arguments[2]', etc
protected static java.util.Map<java.lang.String,org.openqa.selenium.remote.CommandInfo> getCustomCommands()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |