selenium-webdriver 3.5.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGES.md +39 -0
- package/README.md +3 -6
- package/example/async_await_test.js +5 -4
- package/example/chrome_android.js +2 -3
- package/example/chrome_mobile_emulation.js +2 -3
- package/example/firefox_channels.js +3 -3
- package/example/google_search.js +3 -3
- package/example/google_search_generator.js +2 -5
- package/example/google_search_test.js +4 -5
- package/example/{chrome_headless.js → headless.js} +15 -7
- package/example/logging.js +3 -3
- package/example/parallel_flows.js +4 -7
- package/firefox/binary.js +3 -0
- package/firefox/index.js +117 -167
- package/firefox/profile.js +7 -90
- package/lib/atoms/{getAttribute.js → get-attribute.js} +0 -0
- package/lib/capabilities.js +60 -21
- package/lib/error.js +19 -1
- package/lib/http.js +1 -1
- package/lib/promise.js +4 -12
- package/lib/test/data/content-editable.html +10 -0
- package/lib/test/data/scrolling_tests/page_with_partially_hidden_element.html +14 -0
- package/lib/test/index.js +1 -1
- package/lib/webdriver.js +29 -33
- package/package.json +1 -1
- package/remote/index.js +4 -3
- package/test/firefox/firefox_test.js +16 -33
- package/test/lib/error_test.js +1 -0
- package/testing/index.js +2 -3
- package/lib/firefox/webdriver.json +0 -70
package/CHANGES.md
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
|
+
## v3.6.0
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
* The Capabilities factory methods should only specify the name of the browser.
|
|
6
|
+
* Protect against the remote end sometimes not returning a list to findElements
|
|
7
|
+
commands.
|
|
8
|
+
* Properly reset state in `remote.DriverService#kill()`
|
|
9
|
+
* The firefox module will no longer apply the preferences required by the legacy
|
|
10
|
+
FirefoxDriver. These preferences were only required when using the legacy
|
|
11
|
+
driver, support for which was dropped in v3.5.0.
|
|
12
|
+
|
|
13
|
+
### API Changes
|
|
14
|
+
|
|
15
|
+
* Added new methods to `selenium-webdriver/firefox.Options`:
|
|
16
|
+
- addArguments()
|
|
17
|
+
- headless()
|
|
18
|
+
- windowSize()
|
|
19
|
+
* Deprecated `selenium-webdriver/firefox/binary.Binary`
|
|
20
|
+
* Removed `selenium-webdriver/firefox.Options#useGeckoDriver()`
|
|
21
|
+
* Removed the unused `selenium-webdriver/firefox/profile.decode()`
|
|
22
|
+
* Removed methods from `selenium-webdriver/firefox/profile.Profile` that had
|
|
23
|
+
no effect since support for the legacy FirefoxDriver was dropped in 3.5.0:
|
|
24
|
+
- setNativeEventsEnabled
|
|
25
|
+
- nativeEventsEnabled
|
|
26
|
+
- getPort
|
|
27
|
+
- setPort
|
|
28
|
+
* Removed `selenium-webdriver/firefox.ServiceBuilder#setFirefoxBinary()`; custom
|
|
29
|
+
binaries should be configured through the `firefox.Options` class.
|
|
30
|
+
* Removed `selenium-webdriver/firefox.Capability`. These hold overs from the
|
|
31
|
+
legacy FirefoxDriver are no longer supported.
|
|
32
|
+
|
|
33
|
+
### Changes for W3C WebDriver Spec Compliance
|
|
34
|
+
|
|
35
|
+
* Deprecated `error.ElementNotVisibleError` in favor of the more generic
|
|
36
|
+
`error.ElementNotInteractableError`.
|
|
37
|
+
* Support the `httpOnly` option when adding a cookie.
|
|
38
|
+
|
|
39
|
+
|
|
1
40
|
## v3.5.0
|
|
2
41
|
|
|
3
42
|
### Notice
|
package/README.md
CHANGED
|
@@ -33,17 +33,14 @@ Automation in the Develop menu of Safari 10 before testing.
|
|
|
33
33
|
The sample below and others are included in the `example` directory. You may
|
|
34
34
|
also find the tests for selenium-webdriver informative.
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
By = webdriver.By,
|
|
38
|
-
until = webdriver.until;
|
|
36
|
+
const {Builder, By, Key, until} = require('selenium-webdriver');
|
|
39
37
|
|
|
40
|
-
|
|
38
|
+
let driver = new Builder()
|
|
41
39
|
.forBrowser('firefox')
|
|
42
40
|
.build();
|
|
43
41
|
|
|
44
42
|
driver.get('http://www.google.com/ncr');
|
|
45
|
-
driver.findElement(By.name('q')).sendKeys('webdriver');
|
|
46
|
-
driver.findElement(By.name('btnG')).click();
|
|
43
|
+
driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN);
|
|
47
44
|
driver.wait(until.titleIs('webdriver - Google Search'), 1000);
|
|
48
45
|
driver.quit();
|
|
49
46
|
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
'use strict';
|
|
35
35
|
|
|
36
36
|
const assert = require('assert');
|
|
37
|
-
const {Builder, By, promise, until} = require('..');
|
|
37
|
+
const {Builder, By, Key, promise, until} = require('..');
|
|
38
38
|
|
|
39
39
|
// async/await do not work well when the promise manager is enabled.
|
|
40
40
|
// See https://github.com/SeleniumHQ/selenium/issues/3037
|
|
@@ -57,12 +57,13 @@ describe('Google Search', function() {
|
|
|
57
57
|
it('example', async function() {
|
|
58
58
|
await driver.get('https://www.google.com/ncr');
|
|
59
59
|
|
|
60
|
-
await driver.findElement(By.name('q')).sendKeys('webdriver');
|
|
61
|
-
await driver.findElement(By.name('btnG')).click();
|
|
60
|
+
await driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN);
|
|
62
61
|
|
|
63
62
|
await driver.wait(until.titleIs('webdriver - Google Search'), 1000);
|
|
64
63
|
|
|
65
64
|
let url = await driver.getCurrentUrl();
|
|
66
|
-
assert.
|
|
65
|
+
assert.ok(
|
|
66
|
+
url.startsWith('https://www.google.com/search'),
|
|
67
|
+
'unexpected url: ' + url);
|
|
67
68
|
});
|
|
68
69
|
});
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
|
|
24
24
|
'use strict';
|
|
25
25
|
|
|
26
|
-
const {Builder, By, promise, until} = require('..');
|
|
26
|
+
const {Builder, By, Key, promise, until} = require('..');
|
|
27
27
|
const {Options} = require('../chrome');
|
|
28
28
|
|
|
29
29
|
promise.consume(function* () {
|
|
@@ -34,8 +34,7 @@ promise.consume(function* () {
|
|
|
34
34
|
.setChromeOptions(new Options().androidChrome())
|
|
35
35
|
.build();
|
|
36
36
|
yield driver.get('http://www.google.com/ncr');
|
|
37
|
-
yield driver.findElement(By.name('q')).sendKeys('webdriver');
|
|
38
|
-
yield driver.findElement(By.name('btnG')).click();
|
|
37
|
+
yield driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN);
|
|
39
38
|
yield driver.wait(until.titleIs('webdriver - Google Search'), 1000);
|
|
40
39
|
} finally {
|
|
41
40
|
yield driver && driver.quit();
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
'use strict';
|
|
24
24
|
|
|
25
|
-
const {Builder, By, promise, until} = require('..');
|
|
25
|
+
const {Builder, By, Key, promise, until} = require('..');
|
|
26
26
|
const {Options} = require('../chrome');
|
|
27
27
|
|
|
28
28
|
promise.consume(function* () {
|
|
@@ -34,8 +34,7 @@ promise.consume(function* () {
|
|
|
34
34
|
new Options().setMobileEmulation({deviceName: 'Nexus 5X'}))
|
|
35
35
|
.build();
|
|
36
36
|
yield driver.get('http://www.google.com/ncr');
|
|
37
|
-
yield driver.findElement(By.name('q')).sendKeys('webdriver');
|
|
38
|
-
yield driver.findElement(By.name('btnG')).click();
|
|
37
|
+
yield driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN);
|
|
39
38
|
yield driver.wait(until.titleIs('webdriver - Google Search'), 1000);
|
|
40
39
|
} finally {
|
|
41
40
|
yield driver && driver.quit();
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
'use strict';
|
|
29
29
|
|
|
30
|
-
const {Builder, By, promise, until} = require('..');
|
|
30
|
+
const {Builder, By, Key, promise, until} = require('..');
|
|
31
31
|
const {Channel, Options} = require('../firefox');
|
|
32
32
|
|
|
33
33
|
let i = 0;
|
|
@@ -45,8 +45,8 @@ function doSearch(driver) {
|
|
|
45
45
|
.then(_ => promise.delayed(750))
|
|
46
46
|
// Now do the rest.
|
|
47
47
|
.then(_ => driver.get('http://www.google.com/ncr'))
|
|
48
|
-
.then(_ =>
|
|
49
|
-
|
|
48
|
+
.then(_ =>
|
|
49
|
+
driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN))
|
|
50
50
|
.then(_ => driver.wait(until.titleIs('webdriver - Google Search'), 1000))
|
|
51
51
|
.then(_ => driver.quit());
|
|
52
52
|
}
|
package/example/google_search.js
CHANGED
|
@@ -37,14 +37,14 @@
|
|
|
37
37
|
* node selenium-webdriver/example/google_search.js
|
|
38
38
|
*/
|
|
39
39
|
|
|
40
|
-
const {Builder, By, until} = require('..');
|
|
40
|
+
const {Builder, By, Key, until} = require('..');
|
|
41
41
|
|
|
42
42
|
var driver = new Builder()
|
|
43
43
|
.forBrowser('firefox')
|
|
44
44
|
.build();
|
|
45
45
|
|
|
46
46
|
driver.get('http://www.google.com/ncr')
|
|
47
|
-
.then(_ =>
|
|
48
|
-
|
|
47
|
+
.then(_ =>
|
|
48
|
+
driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN))
|
|
49
49
|
.then(_ => driver.wait(until.titleIs('webdriver - Google Search'), 1000))
|
|
50
50
|
.then(_ => driver.quit());
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
|
|
29
29
|
'use strict';
|
|
30
30
|
|
|
31
|
-
const {Builder, By, promise, until} = require('..');
|
|
31
|
+
const {Builder, By, Key, promise, until} = require('..');
|
|
32
32
|
|
|
33
33
|
promise.consume(function* () {
|
|
34
34
|
let driver;
|
|
@@ -38,10 +38,7 @@ promise.consume(function* () {
|
|
|
38
38
|
yield driver.get('http://www.google.com/ncr');
|
|
39
39
|
|
|
40
40
|
let q = yield driver.findElement(By.name('q'));
|
|
41
|
-
yield q.sendKeys('webdriver');
|
|
42
|
-
|
|
43
|
-
let btnG = yield driver.findElement(By.name('btnG'));
|
|
44
|
-
yield btnG.click();
|
|
41
|
+
yield q.sendKeys('webdriver', Key.RETURN);
|
|
45
42
|
|
|
46
43
|
yield driver.wait(until.titleIs('webdriver - Google Search'), 1000);
|
|
47
44
|
} finally {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
* mocha -t 10000 selenium-webdriver/example/google_search_test.js
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
|
-
const {Builder, By, until} = require('..');
|
|
32
|
+
const {Builder, By, Key, until} = require('..');
|
|
33
33
|
const test = require('../testing');
|
|
34
34
|
|
|
35
35
|
test.describe('Google Search', function() {
|
|
@@ -42,8 +42,8 @@ test.describe('Google Search', function() {
|
|
|
42
42
|
// You can write tests either using traditional promises.
|
|
43
43
|
it('works with promises', function() {
|
|
44
44
|
return driver.get('http://www.google.com/ncr')
|
|
45
|
-
.then(_ =>
|
|
46
|
-
|
|
45
|
+
.then(_ =>
|
|
46
|
+
driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN))
|
|
47
47
|
.then(_ => driver.wait(until.titleIs('webdriver - Google Search'), 1000));
|
|
48
48
|
});
|
|
49
49
|
|
|
@@ -52,8 +52,7 @@ test.describe('Google Search', function() {
|
|
|
52
52
|
// generator.
|
|
53
53
|
test.it('works with generators', function*() {
|
|
54
54
|
yield driver.get('http://www.google.com/ncr');
|
|
55
|
-
yield driver.findElement(By.name('q')).sendKeys('webdriver');
|
|
56
|
-
yield driver.findElement(By.name('btnG')).click();
|
|
55
|
+
yield driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN);
|
|
57
56
|
yield driver.wait(until.titleIs('webdriver - Google Search'), 1000);
|
|
58
57
|
});
|
|
59
58
|
|
|
@@ -16,18 +16,24 @@
|
|
|
16
16
|
// under the License.
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* @fileoverview An example of running Chrome in headless mode.
|
|
19
|
+
* @fileoverview An example of running Chrome or Firefox in headless mode.
|
|
20
20
|
*
|
|
21
|
-
*
|
|
21
|
+
* To run with Chrome, ensure you have Chrome 59+ installed and that
|
|
22
22
|
* chromedriver 2.30+ is present on your system PATH:
|
|
23
23
|
* <https://sites.google.com/a/chromium.org/chromedriver/downloads>
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
25
|
+
* SELENIUM_BROWSER=chrome node selenium-webdriver/example/headless.js
|
|
26
|
+
*
|
|
27
|
+
* To run with Firefox, ensure you have Firefox 57+ installed and that
|
|
28
|
+
* geckodriver 0.19.0+ is present on your system PATH:
|
|
29
|
+
* <https://github.com/mozilla/geckodriver/releases>
|
|
30
|
+
*
|
|
31
|
+
* SELENIUM_BROWSER=firefox node selenium-webdriver/example/headless.js
|
|
27
32
|
*/
|
|
28
33
|
|
|
29
34
|
const chrome = require('../chrome');
|
|
30
|
-
const
|
|
35
|
+
const firefox = require('../firefox');
|
|
36
|
+
const {Builder, By, Key, until} = require('..');
|
|
31
37
|
|
|
32
38
|
const width = 640;
|
|
33
39
|
const height = 480;
|
|
@@ -36,11 +42,13 @@ let driver = new Builder()
|
|
|
36
42
|
.forBrowser('chrome')
|
|
37
43
|
.setChromeOptions(
|
|
38
44
|
new chrome.Options().headless().windowSize({width, height}))
|
|
45
|
+
.setFirefoxOptions(
|
|
46
|
+
new firefox.Options().headless().windowSize({width, height}))
|
|
39
47
|
.build();
|
|
40
48
|
|
|
41
49
|
driver.get('http://www.google.com/ncr')
|
|
42
|
-
.then(_ =>
|
|
43
|
-
|
|
50
|
+
.then(_ =>
|
|
51
|
+
driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN))
|
|
44
52
|
.then(_ => driver.wait(until.titleIs('webdriver - Google Search'), 1000))
|
|
45
53
|
.then(
|
|
46
54
|
_ => driver.quit(),
|
package/example/logging.js
CHANGED
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
'use strict';
|
|
23
23
|
|
|
24
|
-
const {Builder, By, logging, until} = require('..');
|
|
24
|
+
const {Builder, By, Key, logging, until} = require('..');
|
|
25
25
|
|
|
26
26
|
logging.installConsoleHandler();
|
|
27
27
|
logging.getLogger('webdriver.http').setLevel(logging.Level.ALL);
|
|
@@ -29,7 +29,7 @@ logging.getLogger('webdriver.http').setLevel(logging.Level.ALL);
|
|
|
29
29
|
var driver = new Builder().forBrowser('firefox').build();
|
|
30
30
|
|
|
31
31
|
driver.get('http://www.google.com/ncr')
|
|
32
|
-
.then(_ =>
|
|
33
|
-
|
|
32
|
+
.then(_ =>
|
|
33
|
+
driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN))
|
|
34
34
|
.then(_ => driver.wait(until.titleIs('webdriver - Google Search'), 1000))
|
|
35
35
|
.then(_ => driver.quit());
|
|
@@ -23,18 +23,16 @@
|
|
|
23
23
|
* (see <https://github.com/SeleniumHQ/selenium/issues/2969>).
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
By = webdriver.By,
|
|
28
|
-
until = webdriver.until;
|
|
26
|
+
const {Builder, By, Key, promise, until} = require('..');
|
|
29
27
|
|
|
30
28
|
for (var i = 0; i < 3; i++) {
|
|
31
29
|
(function(n) {
|
|
32
|
-
var flow = new
|
|
30
|
+
var flow = new promise.ControlFlow()
|
|
33
31
|
.on('uncaughtException', function(e) {
|
|
34
32
|
console.log('uncaughtException in flow %d: %s', n, e);
|
|
35
33
|
});
|
|
36
34
|
|
|
37
|
-
var driver = new
|
|
35
|
+
var driver = new Builder().
|
|
38
36
|
forBrowser('firefox').
|
|
39
37
|
setControlFlow(flow). // Comment out this line to see the difference.
|
|
40
38
|
build();
|
|
@@ -44,8 +42,7 @@ for (var i = 0; i < 3; i++) {
|
|
|
44
42
|
driver.manage().window().setPosition(300 * i, 400 * i);
|
|
45
43
|
|
|
46
44
|
driver.get('http://www.google.com');
|
|
47
|
-
driver.findElement(By.name('q')).sendKeys('webdriver');
|
|
48
|
-
driver.findElement(By.name('btnG')).click();
|
|
45
|
+
driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN);
|
|
49
46
|
driver.wait(until.titleIs('webdriver - Google Search'), 1000);
|
|
50
47
|
|
|
51
48
|
driver.quit();
|
package/firefox/binary.js
CHANGED
|
@@ -203,6 +203,8 @@ function installNoFocusLibs(profileDir) {
|
|
|
203
203
|
* `PATH`.
|
|
204
204
|
*
|
|
205
205
|
* @final
|
|
206
|
+
* @deprecated This class will be removed in 4.0. Use the binary management
|
|
207
|
+
* functions available on the {@link ./index.Options firefox.Options} class.
|
|
206
208
|
*/
|
|
207
209
|
class Binary {
|
|
208
210
|
/**
|
|
@@ -242,6 +244,7 @@ class Binary {
|
|
|
242
244
|
* Add arguments to the command line used to start Firefox.
|
|
243
245
|
* @param {...(string|!Array.<string>)} var_args Either the arguments to add
|
|
244
246
|
* as varargs, or the arguments as an array.
|
|
247
|
+
* @deprecated Use {@link ./index.Options#addArguments}.
|
|
245
248
|
*/
|
|
246
249
|
addArguments(var_args) {
|
|
247
250
|
for (var i = 0; i < arguments.length; i++) {
|