aboutsummaryrefslogtreecommitdiff
path: root/node_modules/selenium-webdriver/phantomjs.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/selenium-webdriver/phantomjs.js')
-rw-r--r--node_modules/selenium-webdriver/phantomjs.js21
1 files changed, 7 insertions, 14 deletions
diff --git a/node_modules/selenium-webdriver/phantomjs.js b/node_modules/selenium-webdriver/phantomjs.js
index 2de5364de..baa7cb378 100644
--- a/node_modules/selenium-webdriver/phantomjs.js
+++ b/node_modules/selenium-webdriver/phantomjs.js
@@ -148,6 +148,8 @@ function createExecutor(url) {
*/
class Driver extends webdriver.WebDriver {
/**
+ * Creates a new PhantomJS session.
+ *
* @param {capabilities.Capabilities=} opt_capabilities The desired
* capabilities.
* @param {promise.ControlFlow=} opt_flow The control flow to use,
@@ -155,8 +157,9 @@ class Driver extends webdriver.WebDriver {
* @param {string=} opt_logFile Path to the log file for the phantomjs
* executable's output. For convenience, this may be set at runtime with
* the `SELENIUM_PHANTOMJS_LOG` environment variable.
+ * @return {!Driver} A new driver reference.
*/
- constructor(opt_capabilities, opt_flow, opt_logFile) {
+ static createSession(opt_capabilities, opt_flow, opt_logFile) {
// TODO: add an Options class for consistency with the other driver types.
var caps = opt_capabilities || capabilities.Capabilities.phantomjs();
@@ -207,7 +210,6 @@ class Driver extends webdriver.WebDriver {
var port = portprober.findFreePort();
var service = new remote.DriverService(exe, {
port: port,
- stdio: 'inherit',
args: Promise.resolve(port).then(function(port) {
args.push('--webdriver=' + port);
return args;
@@ -215,17 +217,8 @@ class Driver extends webdriver.WebDriver {
});
var executor = createExecutor(service.start());
- var driver = webdriver.WebDriver.createSession(executor, caps, opt_flow);
-
- super(driver.getSession(), executor, driver.controlFlow());
-
- var boundQuit = this.quit.bind(this);
-
- /** @override */
- this.quit = function() {
- let killService = () => service.kill();
- return boundQuit().then(killService, killService);
- };
+ return /** @type {!Driver} */(webdriver.WebDriver.createSession(
+ executor, caps, opt_flow, this, () => service.kill()));
}
/**
@@ -265,7 +258,7 @@ class Driver extends webdriver.WebDriver {
*
* @param {(string|!Function)} script The script to execute.
* @param {...*} var_args The arguments to pass to the script.
- * @return {!promise.Promise<T>} A promise that resolve to the
+ * @return {!promise.Thenable<T>} A promise that resolve to the
* script's return value.
* @template T
*/