2015-04-04 09:53:59 -07:00
|
|
|
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
|
|
|
// or more contributor license agreements. See the NOTICE file
|
|
|
|
|
// distributed with this work for additional information
|
|
|
|
|
// regarding copyright ownership. The SFC licenses this file
|
|
|
|
|
// to you under the Apache License, Version 2.0 (the
|
|
|
|
|
// "License"); you may not use this file except in compliance
|
|
|
|
|
// with the License. You may obtain a copy of the License at
|
2014-11-12 19:33:37 +00:00
|
|
|
//
|
2015-04-04 09:53:59 -07:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2014-11-12 19:33:37 +00:00
|
|
|
//
|
2015-04-04 09:53:59 -07:00
|
|
|
// Unless required by applicable law or agreed to in writing,
|
|
|
|
|
// software distributed under the License is distributed on an
|
|
|
|
|
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
|
// KIND, either express or implied. See the License for the
|
|
|
|
|
// specific language governing permissions and limitations
|
|
|
|
|
// under the License.
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
|
|
|
|
|
/**
|
2018-11-25 15:31:54 +00:00
|
|
|
* @fileoverview Defines a `webdriver.CommandExecutor` that communicates
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
* with a server over HTTP.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
goog.provide('webdriver.http.Client');
|
|
|
|
|
goog.provide('webdriver.http.Executor');
|
|
|
|
|
goog.provide('webdriver.http.Request');
|
|
|
|
|
goog.provide('webdriver.http.Response');
|
|
|
|
|
|
|
|
|
|
goog.require('bot.ErrorCode');
|
2012-10-14 18:32:47 +00:00
|
|
|
goog.require('goog.array');
|
2014-11-07 23:43:52 -08:00
|
|
|
goog.require('webdriver.CommandExecutor');
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
goog.require('webdriver.CommandName');
|
2015-04-19 11:02:39 -07:00
|
|
|
goog.require('webdriver.logging');
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
|
|
|
|
|
|
2012-09-09 05:20:57 +00:00
|
|
|
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
/**
|
|
|
|
|
* Interface used for sending individual HTTP requests to the server.
|
|
|
|
|
* @interface
|
|
|
|
|
*/
|
|
|
|
|
webdriver.http.Client = function() {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2015-11-13 14:12:26 -08:00
|
|
|
* Sends a request to the server. The client will automatically follow any
|
|
|
|
|
* redirects returned by the server, fulfilling the returned promise with the
|
|
|
|
|
* final response.
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
*
|
|
|
|
|
* @param {!webdriver.http.Request} request The request to send.
|
2016-05-19 15:08:51 -07:00
|
|
|
* @return {!goog.Promise<!webdriver.http.Response>} A promise that
|
2015-11-13 14:12:26 -08:00
|
|
|
* will be fulfilled with the server's response.
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
*/
|
2015-11-13 14:12:26 -08:00
|
|
|
webdriver.http.Client.prototype.send = function(request) {};
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
|
|
|
|
|
|
2012-09-09 05:20:57 +00:00
|
|
|
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
/**
|
|
|
|
|
* A command executor that communicates with a server using the WebDriver
|
|
|
|
|
* command protocol.
|
|
|
|
|
* @param {!webdriver.http.Client} client The client to use when sending
|
|
|
|
|
* requests to the server.
|
|
|
|
|
* @constructor
|
|
|
|
|
* @implements {webdriver.CommandExecutor}
|
|
|
|
|
*/
|
|
|
|
|
webdriver.http.Executor = function(client) {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Client used to communicate with the server.
|
2013-03-10 13:56:37 -07:00
|
|
|
* @private {!webdriver.http.Client}
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
*/
|
|
|
|
|
this.client_ = client;
|
2015-01-02 11:09:33 -08:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @private {!Object<{method:string, path:string}>}
|
|
|
|
|
*/
|
|
|
|
|
this.customCommands_ = {};
|
2015-04-19 11:02:39 -07:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @private {!webdriver.logging.Logger}
|
|
|
|
|
*/
|
|
|
|
|
this.log_ = webdriver.logging.getLogger('webdriver.http.Executor');
|
2015-01-02 11:09:33 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Defines a new command for use with this executor. When a command is sent,
|
2018-11-25 15:31:54 +00:00
|
|
|
* the `path` will be preprocessed using the command's parameters; any
|
2015-01-02 11:09:33 -08:00
|
|
|
* path segments prefixed with ":" will be replaced by the parameter of the
|
|
|
|
|
* same name. For example, given "/person/:name" and the parameters
|
|
|
|
|
* "{name: 'Bob'}", the final command path will be "/person/Bob".
|
|
|
|
|
*
|
|
|
|
|
* @param {string} name The command name.
|
|
|
|
|
* @param {string} method The HTTP method to use when sending this command.
|
2015-01-09 17:00:58 -08:00
|
|
|
* @param {string} path The path to send the command to, relative to
|
2015-01-02 11:09:33 -08:00
|
|
|
* the WebDriver server's command root and of the form
|
|
|
|
|
* "/path/:variable/segment".
|
|
|
|
|
*/
|
|
|
|
|
webdriver.http.Executor.prototype.defineCommand = function(
|
|
|
|
|
name, method, path) {
|
|
|
|
|
this.customCommands_[name] = {method: method, path: path};
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @override */
|
2015-11-13 14:12:26 -08:00
|
|
|
webdriver.http.Executor.prototype.execute = function(command) {
|
2015-01-02 11:09:33 -08:00
|
|
|
var resource =
|
|
|
|
|
this.customCommands_[command.getName()] ||
|
|
|
|
|
webdriver.http.Executor.COMMAND_MAP_[command.getName()];
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
if (!resource) {
|
2012-09-09 05:20:57 +00:00
|
|
|
throw new Error('Unrecognized command: ' + command.getName());
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var parameters = command.getParameters();
|
|
|
|
|
var path = webdriver.http.Executor.buildPath_(resource.path, parameters);
|
|
|
|
|
var request = new webdriver.http.Request(resource.method, path, parameters);
|
|
|
|
|
|
2015-04-19 11:02:39 -07:00
|
|
|
var log = this.log_;
|
|
|
|
|
log.finer(function() {
|
|
|
|
|
return '>>>\n' + request;
|
|
|
|
|
});
|
|
|
|
|
|
2015-11-13 14:12:26 -08:00
|
|
|
return this.client_.send(request).then(function(response) {
|
|
|
|
|
log.finer(function() {
|
|
|
|
|
return '<<<\n' + response;
|
|
|
|
|
});
|
|
|
|
|
return webdriver.http.Executor.parseHttpResponse_(
|
|
|
|
|
/** @type {!webdriver.http.Response} */ (response));
|
2011-10-25 20:29:26 +00:00
|
|
|
});
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Builds a fully qualified path using the given set of command parameters. Each
|
|
|
|
|
* path segment prefixed with ':' will be replaced by the value of the
|
|
|
|
|
* corresponding parameter. All parameters spliced into the path will be
|
|
|
|
|
* removed from the parameter map.
|
|
|
|
|
* @param {string} path The original resource path.
|
2011-10-24 21:33:37 +00:00
|
|
|
* @param {!Object.<*>} parameters The parameters object to splice into
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
* the path.
|
|
|
|
|
* @return {string} The modified path.
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
webdriver.http.Executor.buildPath_ = function(path, parameters) {
|
2011-12-12 19:52:52 +00:00
|
|
|
var pathParameters = path.match(/\/:(\w+)\b/g);
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
if (pathParameters) {
|
|
|
|
|
for (var i = 0; i < pathParameters.length; ++i) {
|
2011-12-12 19:52:52 +00:00
|
|
|
var key = pathParameters[i].substring(2); // Trim the /:
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
if (key in parameters) {
|
|
|
|
|
var value = parameters[key];
|
2013-08-16 11:53:17 -07:00
|
|
|
// TODO: move webdriver.WebElement.ELEMENT definition to a
|
2011-11-23 00:15:00 +00:00
|
|
|
// common file so we can reference it here without pulling in all of
|
|
|
|
|
// webdriver.WebElement's dependencies.
|
|
|
|
|
if (value && value['ELEMENT']) {
|
2011-12-12 18:51:36 +00:00
|
|
|
// When inserting a WebElement into the URL, only use its ID value,
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
// not the full JSON.
|
2011-11-23 00:15:00 +00:00
|
|
|
value = value['ELEMENT'];
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
}
|
2011-12-12 19:52:52 +00:00
|
|
|
path = path.replace(pathParameters[i], '/' + value);
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
delete parameters[key];
|
|
|
|
|
} else {
|
|
|
|
|
throw new Error('Missing required parameter: ' + key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return path;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2011-10-25 20:29:26 +00:00
|
|
|
* Callback used to parse {@link webdriver.http.Response} objects from a
|
|
|
|
|
* {@link webdriver.http.Client}.
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
* @param {!webdriver.http.Response} httpResponse The HTTP response to parse.
|
2012-04-29 04:33:52 +00:00
|
|
|
* @return {!bot.response.ResponseObject} The parsed response.
|
2011-10-25 20:29:26 +00:00
|
|
|
* @private
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
*/
|
2011-10-25 20:29:26 +00:00
|
|
|
webdriver.http.Executor.parseHttpResponse_ = function(httpResponse) {
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
try {
|
2015-06-18 14:22:02 -07:00
|
|
|
return /** @type {!bot.response.ResponseObject} */ (JSON.parse(
|
2012-03-05 13:18:07 +00:00
|
|
|
httpResponse.body));
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
} catch (ex) {
|
2011-10-25 20:29:26 +00:00
|
|
|
// Whoops, looks like the server sent us a malformed response. We'll need
|
|
|
|
|
// to manually build a response object based on the response code.
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var response = {
|
|
|
|
|
'status': bot.ErrorCode.SUCCESS,
|
|
|
|
|
'value': httpResponse.body.replace(/\r\n/g, '\n')
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (!(httpResponse.status > 199 && httpResponse.status < 300)) {
|
|
|
|
|
// 404 represents an unknown command; anything else is a generic unknown
|
|
|
|
|
// error.
|
|
|
|
|
response['status'] = httpResponse.status == 404 ?
|
|
|
|
|
bot.ErrorCode.UNKNOWN_COMMAND :
|
|
|
|
|
bot.ErrorCode.UNKNOWN_ERROR;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return response;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Maps command names to resource locator.
|
2013-03-10 13:56:37 -07:00
|
|
|
* @private {!Object.<{method:string, path:string}>}
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
* @const
|
|
|
|
|
*/
|
|
|
|
|
webdriver.http.Executor.COMMAND_MAP_ = (function() {
|
|
|
|
|
return new Builder().
|
2011-11-23 00:15:00 +00:00
|
|
|
put(webdriver.CommandName.GET_SERVER_STATUS, get('/status')).
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
put(webdriver.CommandName.NEW_SESSION, post('/session')).
|
2011-11-23 00:15:00 +00:00
|
|
|
put(webdriver.CommandName.GET_SESSIONS, get('/sessions')).
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
put(webdriver.CommandName.DESCRIBE_SESSION, get('/session/:sessionId')).
|
|
|
|
|
put(webdriver.CommandName.QUIT, del('/session/:sessionId')).
|
|
|
|
|
put(webdriver.CommandName.CLOSE, del('/session/:sessionId/window')).
|
|
|
|
|
put(webdriver.CommandName.GET_CURRENT_WINDOW_HANDLE,
|
|
|
|
|
get('/session/:sessionId/window_handle')).
|
|
|
|
|
put(webdriver.CommandName.GET_WINDOW_HANDLES,
|
|
|
|
|
get('/session/:sessionId/window_handles')).
|
|
|
|
|
put(webdriver.CommandName.GET_CURRENT_URL,
|
|
|
|
|
get('/session/:sessionId/url')).
|
|
|
|
|
put(webdriver.CommandName.GET, post('/session/:sessionId/url')).
|
|
|
|
|
put(webdriver.CommandName.GO_BACK, post('/session/:sessionId/back')).
|
|
|
|
|
put(webdriver.CommandName.GO_FORWARD,
|
|
|
|
|
post('/session/:sessionId/forward')).
|
|
|
|
|
put(webdriver.CommandName.REFRESH,
|
|
|
|
|
post('/session/:sessionId/refresh')).
|
|
|
|
|
put(webdriver.CommandName.ADD_COOKIE,
|
|
|
|
|
post('/session/:sessionId/cookie')).
|
|
|
|
|
put(webdriver.CommandName.GET_ALL_COOKIES,
|
|
|
|
|
get('/session/:sessionId/cookie')).
|
|
|
|
|
put(webdriver.CommandName.DELETE_ALL_COOKIES,
|
|
|
|
|
del('/session/:sessionId/cookie')).
|
|
|
|
|
put(webdriver.CommandName.DELETE_COOKIE,
|
|
|
|
|
del('/session/:sessionId/cookie/:name')).
|
|
|
|
|
put(webdriver.CommandName.FIND_ELEMENT,
|
|
|
|
|
post('/session/:sessionId/element')).
|
|
|
|
|
put(webdriver.CommandName.FIND_ELEMENTS,
|
|
|
|
|
post('/session/:sessionId/elements')).
|
|
|
|
|
put(webdriver.CommandName.GET_ACTIVE_ELEMENT,
|
|
|
|
|
post('/session/:sessionId/element/active')).
|
|
|
|
|
put(webdriver.CommandName.FIND_CHILD_ELEMENT,
|
|
|
|
|
post('/session/:sessionId/element/:id/element')).
|
|
|
|
|
put(webdriver.CommandName.FIND_CHILD_ELEMENTS,
|
|
|
|
|
post('/session/:sessionId/element/:id/elements')).
|
|
|
|
|
put(webdriver.CommandName.CLEAR_ELEMENT,
|
|
|
|
|
post('/session/:sessionId/element/:id/clear')).
|
|
|
|
|
put(webdriver.CommandName.CLICK_ELEMENT,
|
|
|
|
|
post('/session/:sessionId/element/:id/click')).
|
|
|
|
|
put(webdriver.CommandName.SEND_KEYS_TO_ELEMENT,
|
|
|
|
|
post('/session/:sessionId/element/:id/value')).
|
|
|
|
|
put(webdriver.CommandName.SUBMIT_ELEMENT,
|
|
|
|
|
post('/session/:sessionId/element/:id/submit')).
|
|
|
|
|
put(webdriver.CommandName.GET_ELEMENT_TEXT,
|
|
|
|
|
get('/session/:sessionId/element/:id/text')).
|
|
|
|
|
put(webdriver.CommandName.GET_ELEMENT_TAG_NAME,
|
|
|
|
|
get('/session/:sessionId/element/:id/name')).
|
|
|
|
|
put(webdriver.CommandName.IS_ELEMENT_SELECTED,
|
|
|
|
|
get('/session/:sessionId/element/:id/selected')).
|
|
|
|
|
put(webdriver.CommandName.IS_ELEMENT_ENABLED,
|
|
|
|
|
get('/session/:sessionId/element/:id/enabled')).
|
|
|
|
|
put(webdriver.CommandName.IS_ELEMENT_DISPLAYED,
|
|
|
|
|
get('/session/:sessionId/element/:id/displayed')).
|
|
|
|
|
put(webdriver.CommandName.GET_ELEMENT_LOCATION,
|
|
|
|
|
get('/session/:sessionId/element/:id/location')).
|
|
|
|
|
put(webdriver.CommandName.GET_ELEMENT_SIZE,
|
|
|
|
|
get('/session/:sessionId/element/:id/size')).
|
|
|
|
|
put(webdriver.CommandName.GET_ELEMENT_ATTRIBUTE,
|
|
|
|
|
get('/session/:sessionId/element/:id/attribute/:name')).
|
|
|
|
|
put(webdriver.CommandName.GET_ELEMENT_VALUE_OF_CSS_PROPERTY,
|
2012-01-10 18:37:40 +00:00
|
|
|
get('/session/:sessionId/element/:id/css/:propertyName')).
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
put(webdriver.CommandName.ELEMENT_EQUALS,
|
|
|
|
|
get('/session/:sessionId/element/:id/equals/:other')).
|
2015-11-01 20:12:44 -08:00
|
|
|
put(webdriver.CommandName.TAKE_ELEMENT_SCREENSHOT,
|
|
|
|
|
get('/session/:sessionId/element/:id/screenshot')).
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
put(webdriver.CommandName.SWITCH_TO_WINDOW,
|
|
|
|
|
post('/session/:sessionId/window')).
|
2012-11-16 20:02:47 +00:00
|
|
|
put(webdriver.CommandName.MAXIMIZE_WINDOW,
|
|
|
|
|
post('/session/:sessionId/window/:windowHandle/maximize')).
|
2012-04-25 23:46:12 +00:00
|
|
|
put(webdriver.CommandName.GET_WINDOW_POSITION,
|
|
|
|
|
get('/session/:sessionId/window/:windowHandle/position')).
|
|
|
|
|
put(webdriver.CommandName.SET_WINDOW_POSITION,
|
|
|
|
|
post('/session/:sessionId/window/:windowHandle/position')).
|
|
|
|
|
put(webdriver.CommandName.GET_WINDOW_SIZE,
|
|
|
|
|
get('/session/:sessionId/window/:windowHandle/size')).
|
|
|
|
|
put(webdriver.CommandName.SET_WINDOW_SIZE,
|
|
|
|
|
post('/session/:sessionId/window/:windowHandle/size')).
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
put(webdriver.CommandName.SWITCH_TO_FRAME,
|
|
|
|
|
post('/session/:sessionId/frame')).
|
|
|
|
|
put(webdriver.CommandName.GET_PAGE_SOURCE,
|
|
|
|
|
get('/session/:sessionId/source')).
|
|
|
|
|
put(webdriver.CommandName.GET_TITLE,
|
|
|
|
|
get('/session/:sessionId/title')).
|
|
|
|
|
put(webdriver.CommandName.EXECUTE_SCRIPT,
|
|
|
|
|
post('/session/:sessionId/execute')).
|
|
|
|
|
put(webdriver.CommandName.EXECUTE_ASYNC_SCRIPT,
|
|
|
|
|
post('/session/:sessionId/execute_async')).
|
|
|
|
|
put(webdriver.CommandName.SCREENSHOT,
|
|
|
|
|
get('/session/:sessionId/screenshot')).
|
2013-04-23 20:35:55 -07:00
|
|
|
put(webdriver.CommandName.SET_TIMEOUT,
|
|
|
|
|
post('/session/:sessionId/timeouts')).
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
put(webdriver.CommandName.SET_SCRIPT_TIMEOUT,
|
|
|
|
|
post('/session/:sessionId/timeouts/async_script')).
|
|
|
|
|
put(webdriver.CommandName.IMPLICITLY_WAIT,
|
|
|
|
|
post('/session/:sessionId/timeouts/implicit_wait')).
|
2012-06-08 21:43:13 +00:00
|
|
|
put(webdriver.CommandName.MOVE_TO, post('/session/:sessionId/moveto')).
|
|
|
|
|
put(webdriver.CommandName.CLICK, post('/session/:sessionId/click')).
|
|
|
|
|
put(webdriver.CommandName.DOUBLE_CLICK,
|
|
|
|
|
post('/session/:sessionId/doubleclick')).
|
|
|
|
|
put(webdriver.CommandName.MOUSE_DOWN,
|
|
|
|
|
post('/session/:sessionId/buttondown')).
|
|
|
|
|
put(webdriver.CommandName.MOUSE_UP, post('/session/:sessionId/buttonup')).
|
|
|
|
|
put(webdriver.CommandName.MOVE_TO, post('/session/:sessionId/moveto')).
|
|
|
|
|
put(webdriver.CommandName.SEND_KEYS_TO_ACTIVE_ELEMENT,
|
|
|
|
|
post('/session/:sessionId/keys')).
|
2015-02-02 19:28:40 -08:00
|
|
|
put(webdriver.CommandName.TOUCH_SINGLE_TAP,
|
|
|
|
|
post('/session/:sessionId/touch/click')).
|
|
|
|
|
put(webdriver.CommandName.TOUCH_DOUBLE_TAP,
|
|
|
|
|
post('/session/:sessionId/touch/doubleclick')).
|
|
|
|
|
put(webdriver.CommandName.TOUCH_DOWN,
|
|
|
|
|
post('/session/:sessionId/touch/down')).
|
|
|
|
|
put(webdriver.CommandName.TOUCH_UP,
|
|
|
|
|
post('/session/:sessionId/touch/up')).
|
|
|
|
|
put(webdriver.CommandName.TOUCH_MOVE,
|
|
|
|
|
post('/session/:sessionId/touch/move')).
|
|
|
|
|
put(webdriver.CommandName.TOUCH_SCROLL,
|
|
|
|
|
post('/session/:sessionId/touch/scroll')).
|
|
|
|
|
put(webdriver.CommandName.TOUCH_LONG_PRESS,
|
|
|
|
|
post('/session/:sessionId/touch/longclick')).
|
|
|
|
|
put(webdriver.CommandName.TOUCH_FLICK,
|
|
|
|
|
post('/session/:sessionId/touch/flick')).
|
2012-11-05 02:48:38 +00:00
|
|
|
put(webdriver.CommandName.ACCEPT_ALERT,
|
|
|
|
|
post('/session/:sessionId/accept_alert')).
|
|
|
|
|
put(webdriver.CommandName.DISMISS_ALERT,
|
|
|
|
|
post('/session/:sessionId/dismiss_alert')).
|
|
|
|
|
put(webdriver.CommandName.GET_ALERT_TEXT,
|
|
|
|
|
get('/session/:sessionId/alert_text')).
|
|
|
|
|
put(webdriver.CommandName.SET_ALERT_TEXT,
|
|
|
|
|
post('/session/:sessionId/alert_text')).
|
2013-04-28 18:12:33 -07:00
|
|
|
put(webdriver.CommandName.GET_LOG, post('/session/:sessionId/log')).
|
|
|
|
|
put(webdriver.CommandName.GET_AVAILABLE_LOG_TYPES,
|
|
|
|
|
get('/session/:sessionId/log/types')).
|
|
|
|
|
put(webdriver.CommandName.GET_SESSION_LOGS, post('/logs')).
|
2015-02-11 09:28:48 -08:00
|
|
|
put(webdriver.CommandName.UPLOAD_FILE, post('/session/:sessionId/file')).
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
build();
|
|
|
|
|
|
2012-03-05 13:18:07 +00:00
|
|
|
/** @constructor */
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
function Builder() {
|
|
|
|
|
var map = {};
|
|
|
|
|
|
|
|
|
|
this.put = function(name, resource) {
|
|
|
|
|
map[name] = resource;
|
|
|
|
|
return this;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.build = function() {
|
|
|
|
|
return map;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function post(path) { return resource('POST', path); }
|
|
|
|
|
function del(path) { return resource('DELETE', path); }
|
|
|
|
|
function get(path) { return resource('GET', path); }
|
2012-09-09 05:20:57 +00:00
|
|
|
function resource(method, path) { return {method: method, path: path}; }
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
})();
|
|
|
|
|
|
|
|
|
|
|
2011-12-12 19:52:52 +00:00
|
|
|
/**
|
|
|
|
|
* Converts a headers object to a HTTP header block string.
|
|
|
|
|
* @param {!Object.<string>} headers The headers object to convert.
|
|
|
|
|
* @return {string} The headers as a string.
|
|
|
|
|
* @private
|
|
|
|
|
*/
|
|
|
|
|
webdriver.http.headersToString_ = function(headers) {
|
|
|
|
|
var ret = [];
|
|
|
|
|
for (var key in headers) {
|
|
|
|
|
ret.push(key + ': ' + headers[key]);
|
|
|
|
|
}
|
|
|
|
|
return ret.join('\n');
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2012-09-09 05:20:57 +00:00
|
|
|
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
/**
|
|
|
|
|
* Describes a partial HTTP request. This class is a "partial" request and only
|
|
|
|
|
* defines the path on the server to send a request to. It is each
|
2015-02-19 13:50:30 -08:00
|
|
|
* {@link webdriver.http.Client}'s responsibility to build the full URL for the
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
* final request.
|
|
|
|
|
* @param {string} method The HTTP method to use for the request.
|
|
|
|
|
* @param {string} path Path on the server to send the request to.
|
JasonLeyba: Drop JSONP for using WebDriverJs in the browser and rely solely on CORS. This means using WebDriverJs in the browser will only be supported by WebKit, Firefox, IE8+, and Opera 12+.
Unfortunately, the various browser implementations of CORS are not consistent:
* IE's XDomainRequest object may only generate requests that could be generated using a HTML form. This means it cannot generate the DELETE requests required by the JsonWireProtocol.
* WebKit's implementation of CORS does not follow the spec and forbids redirects.
* If the server returns an error response (e.g., 4xx or 5xx), IE and Opera's implementations will fire the on error handler, but without the server's response text. This renders IE and Opera incapable of handling command failures in the standard JSON protocol.
To work around this issues, I've defined a single end-point on the server to handle all CORS-based requests: /xdrpc (cross-domain rpc). This end-point accepts POST requests with a JSON body of the form {method:string, path:string, data:!Object}
The server will decode the command in the request body and route it to the correct command handler. The command response will always be returned as a standard JSON response object: {status:number, value:*}. The response will always be sent with a 200 response, so clients must rely on the response's "status" field to determine whether the command succeeded.
This has been tested against Chrome, Firefox, IE, and Opera Next (12.0a)
r15330
2012-01-01 02:15:34 +00:00
|
|
|
* @param {Object=} opt_data This request's JSON data.
|
2011-10-24 21:17:52 +00:00
|
|
|
* @constructor
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
*/
|
|
|
|
|
webdriver.http.Request = function(method, path, opt_data) {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The HTTP method to use for the request.
|
|
|
|
|
* @type {string}
|
|
|
|
|
*/
|
|
|
|
|
this.method = method;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The path on the server to send the request to.
|
|
|
|
|
* @type {string}
|
|
|
|
|
*/
|
|
|
|
|
this.path = path;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This request's body.
|
JasonLeyba: Drop JSONP for using WebDriverJs in the browser and rely solely on CORS. This means using WebDriverJs in the browser will only be supported by WebKit, Firefox, IE8+, and Opera 12+.
Unfortunately, the various browser implementations of CORS are not consistent:
* IE's XDomainRequest object may only generate requests that could be generated using a HTML form. This means it cannot generate the DELETE requests required by the JsonWireProtocol.
* WebKit's implementation of CORS does not follow the spec and forbids redirects.
* If the server returns an error response (e.g., 4xx or 5xx), IE and Opera's implementations will fire the on error handler, but without the server's response text. This renders IE and Opera incapable of handling command failures in the standard JSON protocol.
To work around this issues, I've defined a single end-point on the server to handle all CORS-based requests: /xdrpc (cross-domain rpc). This end-point accepts POST requests with a JSON body of the form {method:string, path:string, data:!Object}
The server will decode the command in the request body and route it to the correct command handler. The command response will always be returned as a standard JSON response object: {status:number, value:*}. The response will always be sent with a 200 response, so clients must rely on the response's "status" field to determine whether the command succeeded.
This has been tested against Chrome, Firefox, IE, and Opera Next (12.0a)
r15330
2012-01-01 02:15:34 +00:00
|
|
|
* @type {!Object}
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
*/
|
JasonLeyba: Drop JSONP for using WebDriverJs in the browser and rely solely on CORS. This means using WebDriverJs in the browser will only be supported by WebKit, Firefox, IE8+, and Opera 12+.
Unfortunately, the various browser implementations of CORS are not consistent:
* IE's XDomainRequest object may only generate requests that could be generated using a HTML form. This means it cannot generate the DELETE requests required by the JsonWireProtocol.
* WebKit's implementation of CORS does not follow the spec and forbids redirects.
* If the server returns an error response (e.g., 4xx or 5xx), IE and Opera's implementations will fire the on error handler, but without the server's response text. This renders IE and Opera incapable of handling command failures in the standard JSON protocol.
To work around this issues, I've defined a single end-point on the server to handle all CORS-based requests: /xdrpc (cross-domain rpc). This end-point accepts POST requests with a JSON body of the form {method:string, path:string, data:!Object}
The server will decode the command in the request body and route it to the correct command handler. The command response will always be returned as a standard JSON response object: {status:number, value:*}. The response will always be sent with a 200 response, so clients must rely on the response's "status" field to determine whether the command succeeded.
This has been tested against Chrome, Firefox, IE, and Opera Next (12.0a)
r15330
2012-01-01 02:15:34 +00:00
|
|
|
this.data = opt_data || {};
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The headers to send with the request.
|
2012-03-05 13:18:07 +00:00
|
|
|
* @type {!Object.<(string|number)>}
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
*/
|
|
|
|
|
this.headers = {'Accept': 'application/json; charset=utf-8'};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @override */
|
|
|
|
|
webdriver.http.Request.prototype.toString = function() {
|
JasonLeyba: Drop JSONP for using WebDriverJs in the browser and rely solely on CORS. This means using WebDriverJs in the browser will only be supported by WebKit, Firefox, IE8+, and Opera 12+.
Unfortunately, the various browser implementations of CORS are not consistent:
* IE's XDomainRequest object may only generate requests that could be generated using a HTML form. This means it cannot generate the DELETE requests required by the JsonWireProtocol.
* WebKit's implementation of CORS does not follow the spec and forbids redirects.
* If the server returns an error response (e.g., 4xx or 5xx), IE and Opera's implementations will fire the on error handler, but without the server's response text. This renders IE and Opera incapable of handling command failures in the standard JSON protocol.
To work around this issues, I've defined a single end-point on the server to handle all CORS-based requests: /xdrpc (cross-domain rpc). This end-point accepts POST requests with a JSON body of the form {method:string, path:string, data:!Object}
The server will decode the command in the request body and route it to the correct command handler. The command response will always be returned as a standard JSON response object: {status:number, value:*}. The response will always be sent with a 200 response, so clients must rely on the response's "status" field to determine whether the command succeeded.
This has been tested against Chrome, Firefox, IE, and Opera Next (12.0a)
r15330
2012-01-01 02:15:34 +00:00
|
|
|
return [
|
2011-12-12 19:52:52 +00:00
|
|
|
this.method + ' ' + this.path + ' HTTP/1.1',
|
|
|
|
|
webdriver.http.headersToString_(this.headers),
|
JasonLeyba: Drop JSONP for using WebDriverJs in the browser and rely solely on CORS. This means using WebDriverJs in the browser will only be supported by WebKit, Firefox, IE8+, and Opera 12+.
Unfortunately, the various browser implementations of CORS are not consistent:
* IE's XDomainRequest object may only generate requests that could be generated using a HTML form. This means it cannot generate the DELETE requests required by the JsonWireProtocol.
* WebKit's implementation of CORS does not follow the spec and forbids redirects.
* If the server returns an error response (e.g., 4xx or 5xx), IE and Opera's implementations will fire the on error handler, but without the server's response text. This renders IE and Opera incapable of handling command failures in the standard JSON protocol.
To work around this issues, I've defined a single end-point on the server to handle all CORS-based requests: /xdrpc (cross-domain rpc). This end-point accepts POST requests with a JSON body of the form {method:string, path:string, data:!Object}
The server will decode the command in the request body and route it to the correct command handler. The command response will always be returned as a standard JSON response object: {status:number, value:*}. The response will always be sent with a 200 response, so clients must rely on the response's "status" field to determine whether the command succeeded.
This has been tested against Chrome, Firefox, IE, and Opera Next (12.0a)
r15330
2012-01-01 02:15:34 +00:00
|
|
|
'',
|
2015-06-18 14:22:02 -07:00
|
|
|
JSON.stringify(this.data)
|
JasonLeyba: Drop JSONP for using WebDriverJs in the browser and rely solely on CORS. This means using WebDriverJs in the browser will only be supported by WebKit, Firefox, IE8+, and Opera 12+.
Unfortunately, the various browser implementations of CORS are not consistent:
* IE's XDomainRequest object may only generate requests that could be generated using a HTML form. This means it cannot generate the DELETE requests required by the JsonWireProtocol.
* WebKit's implementation of CORS does not follow the spec and forbids redirects.
* If the server returns an error response (e.g., 4xx or 5xx), IE and Opera's implementations will fire the on error handler, but without the server's response text. This renders IE and Opera incapable of handling command failures in the standard JSON protocol.
To work around this issues, I've defined a single end-point on the server to handle all CORS-based requests: /xdrpc (cross-domain rpc). This end-point accepts POST requests with a JSON body of the form {method:string, path:string, data:!Object}
The server will decode the command in the request body and route it to the correct command handler. The command response will always be returned as a standard JSON response object: {status:number, value:*}. The response will always be sent with a 200 response, so clients must rely on the response's "status" field to determine whether the command succeeded.
This has been tested against Chrome, Firefox, IE, and Opera Next (12.0a)
r15330
2012-01-01 02:15:34 +00:00
|
|
|
].join('\n');
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2012-09-09 05:20:57 +00:00
|
|
|
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
/**
|
|
|
|
|
* Represents a HTTP response.
|
|
|
|
|
* @param {number} status The response code.
|
2011-10-24 21:33:37 +00:00
|
|
|
* @param {!Object.<string>} headers The response headers. All header
|
2012-09-09 05:20:57 +00:00
|
|
|
* names will be converted to lowercase strings for consistent lookups.
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
* @param {string} body The response body.
|
|
|
|
|
* @constructor
|
|
|
|
|
*/
|
|
|
|
|
webdriver.http.Response = function(status, headers, body) {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The HTTP response code.
|
|
|
|
|
* @type {number}
|
|
|
|
|
*/
|
|
|
|
|
this.status = status;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The response body.
|
|
|
|
|
* @type {string}
|
|
|
|
|
*/
|
|
|
|
|
this.body = body;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The response body.
|
2011-10-24 21:33:37 +00:00
|
|
|
* @type {!Object.<string>}
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
*/
|
|
|
|
|
this.headers = {};
|
|
|
|
|
for (var header in headers) {
|
|
|
|
|
this.headers[header.toLowerCase()] = headers[header];
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2015-02-19 13:50:30 -08:00
|
|
|
* Builds a {@link webdriver.http.Response} from a {@link XMLHttpRequest} or
|
|
|
|
|
* {@link XDomainRequest} response object.
|
JasonLeyba: Drop JSONP for using WebDriverJs in the browser and rely solely on CORS. This means using WebDriverJs in the browser will only be supported by WebKit, Firefox, IE8+, and Opera 12+.
Unfortunately, the various browser implementations of CORS are not consistent:
* IE's XDomainRequest object may only generate requests that could be generated using a HTML form. This means it cannot generate the DELETE requests required by the JsonWireProtocol.
* WebKit's implementation of CORS does not follow the spec and forbids redirects.
* If the server returns an error response (e.g., 4xx or 5xx), IE and Opera's implementations will fire the on error handler, but without the server's response text. This renders IE and Opera incapable of handling command failures in the standard JSON protocol.
To work around this issues, I've defined a single end-point on the server to handle all CORS-based requests: /xdrpc (cross-domain rpc). This end-point accepts POST requests with a JSON body of the form {method:string, path:string, data:!Object}
The server will decode the command in the request body and route it to the correct command handler. The command response will always be returned as a standard JSON response object: {status:number, value:*}. The response will always be sent with a 200 response, so clients must rely on the response's "status" field to determine whether the command succeeded.
This has been tested against Chrome, Firefox, IE, and Opera Next (12.0a)
r15330
2012-01-01 02:15:34 +00:00
|
|
|
* @param {!(XDomainRequest|XMLHttpRequest)} xhr The request to parse.
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
* @return {!webdriver.http.Response} The parsed response.
|
|
|
|
|
*/
|
|
|
|
|
webdriver.http.Response.fromXmlHttpRequest = function(xhr) {
|
|
|
|
|
var headers = {};
|
2011-11-23 00:15:00 +00:00
|
|
|
|
JasonLeyba: Drop JSONP for using WebDriverJs in the browser and rely solely on CORS. This means using WebDriverJs in the browser will only be supported by WebKit, Firefox, IE8+, and Opera 12+.
Unfortunately, the various browser implementations of CORS are not consistent:
* IE's XDomainRequest object may only generate requests that could be generated using a HTML form. This means it cannot generate the DELETE requests required by the JsonWireProtocol.
* WebKit's implementation of CORS does not follow the spec and forbids redirects.
* If the server returns an error response (e.g., 4xx or 5xx), IE and Opera's implementations will fire the on error handler, but without the server's response text. This renders IE and Opera incapable of handling command failures in the standard JSON protocol.
To work around this issues, I've defined a single end-point on the server to handle all CORS-based requests: /xdrpc (cross-domain rpc). This end-point accepts POST requests with a JSON body of the form {method:string, path:string, data:!Object}
The server will decode the command in the request body and route it to the correct command handler. The command response will always be returned as a standard JSON response object: {status:number, value:*}. The response will always be sent with a 200 response, so clients must rely on the response's "status" field to determine whether the command succeeded.
This has been tested against Chrome, Firefox, IE, and Opera Next (12.0a)
r15330
2012-01-01 02:15:34 +00:00
|
|
|
// getAllResponseHeaders is only available on XMLHttpRequest objects.
|
|
|
|
|
if (xhr.getAllResponseHeaders) {
|
|
|
|
|
var tmp = xhr.getAllResponseHeaders();
|
|
|
|
|
if (tmp) {
|
|
|
|
|
tmp = tmp.replace(/\r\n/g, '\n').split('\n');
|
|
|
|
|
goog.array.forEach(tmp, function(header) {
|
|
|
|
|
var parts = header.split(/\s*:\s*/, 2);
|
|
|
|
|
if (parts[0]) {
|
|
|
|
|
headers[parts[0]] = parts[1] || '';
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
2011-11-23 00:15:00 +00:00
|
|
|
}
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
|
2012-03-05 13:18:07 +00:00
|
|
|
// If xhr is a XDomainRequest object, it will not have a status.
|
|
|
|
|
// However, if we're parsing the response from a XDomainRequest, then
|
|
|
|
|
// that request must have been a success, so we can assume status == 200.
|
|
|
|
|
var status = xhr.status || 200;
|
|
|
|
|
return new webdriver.http.Response(status, headers,
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
xhr.responseText.replace(/\0/g, ''));
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** @override */
|
|
|
|
|
webdriver.http.Response.prototype.toString = function() {
|
2011-12-12 19:52:52 +00:00
|
|
|
var headers = webdriver.http.headersToString_(this.headers);
|
|
|
|
|
var ret = ['HTTP/1.1 ' + this.status, headers];
|
|
|
|
|
|
|
|
|
|
if (headers) {
|
|
|
|
|
ret.push('');
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
}
|
2011-12-12 19:52:52 +00:00
|
|
|
|
|
|
|
|
if (this.body) {
|
|
|
|
|
ret.push(this.body);
|
|
|
|
|
}
|
|
|
|
|
|
JasonLeyba: The return of the WebDriver JSAPI. This initial version supports
Firefox, Chrome, IE, and Opera through the Java Selenium server. For the
browsers that support CORS (currently Firefox + webkit), a cross-domain XHR is
used to communicate with the WebDriver server. For the other browsers, we have
to use JSONP. While IE technically supports CORS, it does not support sending
DELETE requests via CORS. Since there are quite a few DELETE commands in the
wire protocol, we have to use JSONP for IE too (yay, IE).
To create a deployable webdriver.js, run $./go webdriverjs
The generated file (build/javascript/webdriver-jsapi/webdriver.js) can be used
in either the browser or with node.
WebDriverJS may only be used in a browser already under WebDriver's control.
Furthermore, the WebDriver server URL and session ID must be passed to the
script via the wdurl and wdsid query parameters, respectively. To help with
debugging, this change includes a simple Node app:
$ ./go webdriverjs build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ java -jar build/java/server/src/org/openqa/selenium/server/server-standalone.jar
$ node javascript/webdriver-jsapi/node/demo.js --help
To manually run the browser demo tests:
$ ./go debug-server
$ node javascript/webdriver-jsapi/node/demo.js \
--browser=chrome \
--wdUrl=http://localhost:4444/wd/hub \
--url=http://localhost:2310/javascript/webdriver-jsapi/test/e2e/example_test.html
There's still a lot to do:
- Fix the :webdriverjs build task
- Wiki/design documentation
- Improve the debug story (as in, write one)
- Write a pure-JS command executor using the atoms. This could theoretically
be used to replace Selenium Core
- Better Node integration
r14327
2011-10-22 01:15:11 +00:00
|
|
|
return ret.join('\n');
|
|
|
|
|
};
|