Skip to content

Commit

Permalink
Add JS bindings for Microsoft's Edge browser
Browse files Browse the repository at this point in the history
Add a base set of capabilities for Microsoft's Edge browser
Add 'EDGE' property to webdriver.Browser object.
Add 'edge' method to webdriver.Capabilities object.

Add edge.js to javascript/node/selenium-webdriver directory

Add Edge-specific Options class

Add Edge-specific ServiceBuilder class

Add an Edge-specific ServiceBuilder class that manages
the Edge WebDriver server in a child process.

Add a WebDriver client for Microsoft's Edge browser

Add license header to edge.js

Add Edge-specific properties and methods to the Builder class

* Create WebDriver client when the Edge browser is specified.
* Add edgeOptions property and setEdgeOptions method.

Update README.md & CHANGES.md

Signed-off-by: Jason Leyba <[email protected]>
  • Loading branch information
mojwang authored and jleyba committed Jan 27, 2016
1 parent 1070ace commit 1d49fa6
Show file tree
Hide file tree
Showing 5 changed files with 418 additions and 3 deletions.
1 change: 1 addition & 0 deletions javascript/node/selenium-webdriver/CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ the selenium-webdriver package README.

### Change Summary

* Add support for Microsoft's Edge web browser
* Bumped the minimum supported version of Node to v4.2.x
* Added `promise.Promise#catch()` for API compatibility with native Promises.
`promise.Promise#thenCatch()` is not yet deprecated, but it simply
Expand Down
6 changes: 4 additions & 2 deletions javascript/node/selenium-webdriver/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Selenium may be installed via npm with

Out of the box, Selenium includes everything you need to work with Firefox. You
will need to download additional components to work with the other major
browsers. The drivers for Chrome, IE, PhantomJS, and Opera are all standalone
executables that should be placed on your
browsers. The drivers for Chrome, PhantomJS, Opera, and Microsoft's IE and Edge
web browsers are all standalone executables that should be available on your
[PATH](http://en.wikipedia.org/wiki/PATH_%28variable%29). The SafariDriver
browser extension should be installed in your browser before using Selenium; we
recommend disabling the extension when using the browser without Selenium or
Expand All @@ -23,6 +23,7 @@ installing the extension in a profile only used for testing.
| ----------------- | ---------------------------------- |
| Chrome | [chromedriver(.exe)][chrome] |
| Internet Explorer | [IEDriverServer.exe][release] |
| Edge | [MicrosoftWebDriver.msi][edge] |
| PhantomJS | [phantomjs(.exe)][phantomjs] |
| Opera | [operadriver(.exe)][opera] |
| Safari | [SafariDriver.safariextz][release] |
Expand Down Expand Up @@ -219,6 +220,7 @@ under the License.
[issues]: https://github.com/SeleniumHQ/selenium/issues
[opera]: https://github.com/operasoftware/operachromiumdriver/releases
[phantomjs]: http://phantomjs.org/
[edge]: http://go.microsoft.com/fwlink/?LinkId=619687
[reduction]: http://www.webkit.org/quality/reduction.html
[release]: http://selenium-release.storage.googleapis.com/index.html
[users]: https://groups.google.com/forum/#!forum/selenium-users
27 changes: 26 additions & 1 deletion javascript/node/selenium-webdriver/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ var Builder = function() {
/** @private {ie.Options} */
this.ieOptions_ = null;

/** @private {edge.Options} */
this.edgeOptions_ = null;

/** @private {safari.Options} */
this.safariOptions_ = null;

Expand Down Expand Up @@ -338,7 +341,7 @@ Builder.prototype.setOperaOptions = function(options) {


/**
* Sets Internet Explorer specific
* Sets Microsoft's Internet Explorer specific
* {@linkplain selenium-webdriver/ie.Options options} for drivers created by
* this builder. Any proxy settings defined on the given options will take
* precedence over those set through {@link #setProxy}.
Expand All @@ -351,6 +354,19 @@ Builder.prototype.setIeOptions = function(options) {
return this;
};

/**
* Sets Microsoft's Edge specific
* {@linkplain selenium-webdriver/edge.Options options} for drivers created by
* this builder. Any proxy settings defined on the given options will take
* precedence over those set through {@link #setProxy}.
*
* @param {!edge.Options} options The MicrosoftEdgeDriver options to use.
* @return {!Builder} A self reference.
*/
Builder.prototype.setEdgeOptions = function(options) {
this.edgeOptions_ = options;
return this;
};

/**
* Sets Safari specific {@linkplain selenium-webdriver/safari.Options options}
Expand Down Expand Up @@ -428,6 +444,9 @@ Builder.prototype.build = function() {

} else if (browser === Browser.SAFARI && this.safariOptions_) {
capabilities.merge(this.safariOptions_.toCapabilities());

} else if (browser === Browser.EDGE && this.edgeOptions_) {
capabilities.merge(this.edgeOptions_.toCapabilities());
}

// Check for a remote browser.
Expand Down Expand Up @@ -465,6 +484,12 @@ Builder.prototype.build = function() {
var ie = require('./ie');
return new ie.Driver(capabilities, this.flow_);

case Browser.EDGE:
// Requiring 'edge' above would create a cycle:
// index -> builder -> edge -> index
var edge = require('./edge');
return new edge.Driver(capabilities, null, this.flow_);

case Browser.OPERA:
// Requiring 'opera' would create a cycle:
// index -> builder -> opera -> index
Expand Down
Loading

0 comments on commit 1d49fa6

Please sign in to comment.