selenium-webdriver 4.0.0-alpha.6 → 4.0.0-beta.2

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.
Files changed (50) hide show
  1. package/CHANGES.md +46 -0
  2. package/LICENSE +202 -0
  3. package/NOTICE +2 -0
  4. package/README.md +2 -0
  5. package/chrome.js +69 -80
  6. package/chromium.js +231 -164
  7. package/{lib/atoms/make-atoms-module.js → devtools/CDPConnection.js} +15 -9
  8. package/edge.js +104 -146
  9. package/example/chrome_android.js +45 -0
  10. package/example/chrome_mobile_emulation.js +46 -0
  11. package/example/firefox_channels.js +84 -0
  12. package/example/google_search.js +50 -0
  13. package/example/google_search_test.js +70 -0
  14. package/example/headless.js +63 -0
  15. package/example/logging.js +64 -0
  16. package/firefox.js +199 -200
  17. package/http/index.js +128 -116
  18. package/http/util.js +56 -64
  19. package/ie.js +180 -104
  20. package/index.js +246 -199
  21. package/io/exec.js +34 -39
  22. package/io/index.js +142 -152
  23. package/io/zip.js +75 -65
  24. package/lib/actions.js +139 -121
  25. package/lib/atoms/find-elements.js +123 -0
  26. package/lib/atoms/get-attribute.js +75 -59
  27. package/lib/atoms/is-displayed.js +72 -72
  28. package/lib/atoms/mutation-listener.js +55 -0
  29. package/lib/by.js +192 -65
  30. package/lib/capabilities.js +76 -86
  31. package/lib/command.js +19 -20
  32. package/lib/error.js +134 -168
  33. package/lib/http.js +337 -232
  34. package/lib/input.js +319 -296
  35. package/lib/logging.js +126 -137
  36. package/lib/promise.js +60 -66
  37. package/lib/proxy.js +31 -41
  38. package/lib/session.js +12 -15
  39. package/lib/symbols.js +3 -4
  40. package/lib/until.js +162 -160
  41. package/lib/webdriver.js +1014 -549
  42. package/net/index.js +30 -36
  43. package/net/portprober.js +30 -143
  44. package/opera.js +406 -0
  45. package/package.json +15 -7
  46. package/proxy.js +2 -2
  47. package/remote/index.js +190 -187
  48. package/safari.js +40 -49
  49. package/testing/index.js +504 -0
  50. package/lib/README +0 -5
@@ -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
+ })()