selenium-webdriver 4.0.0-alpha.7 → 4.0.0-beta.3
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 +56 -0
- package/LICENSE +202 -0
- package/NOTICE +2 -0
- package/README.md +2 -0
- package/chrome.js +69 -79
- package/chromium.js +231 -164
- package/{lib/atoms/make-atoms-module.js → devtools/CDPConnection.js} +15 -9
- package/edge.js +104 -146
- package/example/chrome_android.js +45 -0
- package/example/chrome_mobile_emulation.js +46 -0
- package/example/firefox_channels.js +84 -0
- package/example/google_search.js +50 -0
- package/example/google_search_test.js +70 -0
- package/example/headless.js +63 -0
- package/example/logging.js +64 -0
- package/firefox.js +199 -200
- package/http/index.js +128 -116
- package/http/util.js +56 -64
- package/ie.js +180 -104
- package/index.js +246 -199
- package/io/exec.js +35 -40
- package/io/index.js +146 -157
- package/io/zip.js +75 -66
- package/lib/atoms/find-elements.js +123 -0
- package/lib/atoms/get-attribute.js +75 -59
- package/lib/atoms/is-displayed.js +72 -72
- package/lib/atoms/mutation-listener.js +55 -0
- package/lib/by.js +192 -65
- package/lib/capabilities.js +76 -86
- package/lib/command.js +19 -35
- package/lib/error.js +134 -168
- package/lib/http.js +308 -232
- package/lib/input.js +192 -453
- package/lib/logging.js +126 -137
- package/lib/promise.js +53 -71
- package/lib/proxy.js +31 -41
- package/lib/session.js +12 -15
- package/lib/symbols.js +3 -4
- package/lib/until.js +162 -160
- package/lib/webdriver.js +1014 -549
- package/net/index.js +30 -36
- package/net/portprober.js +30 -143
- package/opera.js +406 -0
- package/package.json +15 -7
- package/proxy.js +2 -2
- package/remote/index.js +189 -187
- package/safari.js +40 -49
- package/testing/index.js +504 -0
- package/lib/README +0 -5
- package/lib/actions.js +0 -609
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
|
+
// or more contributor license agreements. See the NOTICE file
|
|
3
|
+
// distributed with this work for additional information
|
|
4
|
+
// regarding copyright ownership. The SFC licenses this file
|
|
5
|
+
// to you under the Apache License, Version 2.0 (the
|
|
6
|
+
// "License"); you may not use this file except in compliance
|
|
7
|
+
// with the License. You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the License is distributed on an
|
|
13
|
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
// KIND, either express or implied. See the License for the
|
|
15
|
+
// specific language governing permissions and limitations
|
|
16
|
+
// under the License.
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @fileoverview An example of running Chrome or Firefox in headless mode.
|
|
20
|
+
*
|
|
21
|
+
* To run with Chrome, ensure you have Chrome 59+ installed and that
|
|
22
|
+
* chromedriver 2.30+ is present on your system PATH:
|
|
23
|
+
* <https://chromedriver.chromium.org/downloads>
|
|
24
|
+
*
|
|
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
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
const chrome = require('../chrome')
|
|
35
|
+
const firefox = require('../firefox')
|
|
36
|
+
const { Builder, By, Key, until } = require('..')
|
|
37
|
+
|
|
38
|
+
const width = 640
|
|
39
|
+
const height = 480
|
|
40
|
+
|
|
41
|
+
let driver = new Builder()
|
|
42
|
+
.forBrowser('chrome')
|
|
43
|
+
.setChromeOptions(
|
|
44
|
+
new chrome.Options().headless().windowSize({ width, height })
|
|
45
|
+
)
|
|
46
|
+
.setFirefoxOptions(
|
|
47
|
+
new firefox.Options().headless().windowSize({ width, height })
|
|
48
|
+
)
|
|
49
|
+
.build()
|
|
50
|
+
|
|
51
|
+
driver
|
|
52
|
+
.get('http://www.google.com/ncr')
|
|
53
|
+
.then((_) =>
|
|
54
|
+
driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN)
|
|
55
|
+
)
|
|
56
|
+
.then((_) => driver.wait(until.titleIs('webdriver - Google Search'), 1000))
|
|
57
|
+
.then(
|
|
58
|
+
(_) => driver.quit(),
|
|
59
|
+
(e) =>
|
|
60
|
+
driver.quit().then(() => {
|
|
61
|
+
throw e
|
|
62
|
+
})
|
|
63
|
+
)
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
2
|
+
// or more contributor license agreements. See the NOTICE file
|
|
3
|
+
// distributed with this work for additional information
|
|
4
|
+
// regarding copyright ownership. The SFC licenses this file
|
|
5
|
+
// to you under the Apache License, Version 2.0 (the
|
|
6
|
+
// "License"); you may not use this file except in compliance
|
|
7
|
+
// with the License. You may obtain a copy of the License at
|
|
8
|
+
//
|
|
9
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
//
|
|
11
|
+
// Unless required by applicable law or agreed to in writing,
|
|
12
|
+
// software distributed under the License is distributed on an
|
|
13
|
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
// KIND, either express or implied. See the License for the
|
|
15
|
+
// specific language governing permissions and limitations
|
|
16
|
+
// under the License.
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @fileoverview Demonstrates how to use WebDriver's logging sysem.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
'use strict'
|
|
23
|
+
|
|
24
|
+
const chrome = require('../chrome')
|
|
25
|
+
const firefox = require('../firefox')
|
|
26
|
+
const edge = require('../edge')
|
|
27
|
+
const { Builder, By, Key, logging, until } = require('..')
|
|
28
|
+
|
|
29
|
+
logging.installConsoleHandler()
|
|
30
|
+
logging.getLogger('webdriver.http').setLevel(logging.Level.ALL)
|
|
31
|
+
;(async function () {
|
|
32
|
+
let driver
|
|
33
|
+
try {
|
|
34
|
+
driver = await new Builder()
|
|
35
|
+
// Default to using Firefox. This can be overridden at runtime by
|
|
36
|
+
// setting the SELENIUM_BROWSER environment variable:
|
|
37
|
+
//
|
|
38
|
+
// SELENIUM_BROWSER=chrome node selenium-webdriver/example/logging.js
|
|
39
|
+
.forBrowser('firefox')
|
|
40
|
+
// Configure the service for each browser to enable verbose logging and
|
|
41
|
+
// to inherit the stdio settings from the current process. The builder
|
|
42
|
+
// will only start the service if needed for the selected browser.
|
|
43
|
+
.setChromeService(
|
|
44
|
+
new chrome.ServiceBuilder().enableVerboseLogging().setStdio('inherit')
|
|
45
|
+
)
|
|
46
|
+
.setEdgeService(
|
|
47
|
+
process.platform === 'win32'
|
|
48
|
+
? new edge.ServiceBuilder().enableVerboseLogging().setStdio('inherit')
|
|
49
|
+
: null
|
|
50
|
+
)
|
|
51
|
+
.setFirefoxService(
|
|
52
|
+
new firefox.ServiceBuilder().enableVerboseLogging().setStdio('inherit')
|
|
53
|
+
)
|
|
54
|
+
.build()
|
|
55
|
+
|
|
56
|
+
await driver.get('http://www.google.com/ncr')
|
|
57
|
+
await driver.findElement(By.name('q')).sendKeys('webdriver', Key.RETURN)
|
|
58
|
+
await driver.wait(until.titleIs('webdriver - Google Search'), 1000)
|
|
59
|
+
} finally {
|
|
60
|
+
if (driver) {
|
|
61
|
+
await driver.quit()
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
})()
|