selenium-webdriver 4.0.0-alpha.5 → 4.0.0-beta.1

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 (49) hide show
  1. package/CHANGES.md +35 -1
  2. package/LICENSE +1 -1
  3. package/NOTICE +1 -1
  4. package/README.md +4 -4
  5. package/chrome.js +72 -592
  6. package/chromium.js +829 -0
  7. package/devtools/CDPConnection.js +37 -0
  8. package/edge.js +124 -86
  9. package/example/chrome_android.js +16 -13
  10. package/example/chrome_mobile_emulation.js +18 -14
  11. package/example/firefox_channels.js +35 -28
  12. package/example/google_search.js +9 -9
  13. package/example/google_search_test.js +20 -22
  14. package/example/headless.js +27 -19
  15. package/example/logging.js +34 -38
  16. package/firefox.js +200 -200
  17. package/http/index.js +131 -115
  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 +140 -122
  25. package/lib/atoms/find-elements.js +124 -0
  26. package/lib/atoms/get-attribute.js +79 -59
  27. package/lib/atoms/is-displayed.js +72 -73
  28. package/lib/atoms/mutation-listener.js +38 -0
  29. package/lib/by.js +192 -65
  30. package/lib/capabilities.js +82 -78
  31. package/lib/command.js +20 -20
  32. package/lib/error.js +134 -168
  33. package/lib/http.js +337 -230
  34. package/lib/input.js +325 -302
  35. package/lib/logging.js +127 -138
  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 +1024 -541
  42. package/net/index.js +30 -36
  43. package/net/portprober.js +31 -144
  44. package/opera.js +406 -0
  45. package/package.json +19 -12
  46. package/proxy.js +2 -2
  47. package/remote/index.js +190 -187
  48. package/safari.js +40 -49
  49. package/testing/index.js +166 -155
package/safari.js CHANGED
@@ -19,19 +19,13 @@
19
19
  * @fileoverview Defines a WebDriver client for Safari.
20
20
  */
21
21
 
22
- 'use strict';
23
-
24
- const command = require('./lib/command');
25
- const error = require('./lib/error');
26
- const http = require('./http');
27
- const io = require('./io');
28
- const portprober = require('./net/portprober');
29
- const promise = require('./lib/promise');
30
- const remote = require('./remote');
31
- const Symbols = require('./lib/symbols');
32
- const webdriver = require('./lib/webdriver');
33
- const {Browser, Capabilities, Capability} = require('./lib/capabilities');
22
+ 'use strict'
34
23
 
24
+ const http = require('./http')
25
+ const io = require('./io')
26
+ const remote = require('./remote')
27
+ const webdriver = require('./lib/webdriver')
28
+ const { Browser, Capabilities } = require('./lib/capabilities')
35
29
 
36
30
  /**
37
31
  * _Synchronously_ attempts to locate the IE driver executable on the current
@@ -41,25 +35,25 @@ const {Browser, Capabilities, Capability} = require('./lib/capabilities');
41
35
  */
42
36
  function locateSynchronously() {
43
37
  return process.platform === 'darwin'
44
- ? io.findInPath('safaridriver', true) : null;
38
+ ? io.findInPath('safaridriver', true)
39
+ : null
45
40
  }
46
41
 
47
-
48
42
  /**
49
43
  * @return {string} .
50
44
  * @throws {Error}
51
45
  */
52
46
  function findSafariDriver() {
53
- let exe = locateSynchronously();
47
+ let exe = locateSynchronously()
54
48
  if (!exe) {
55
49
  throw Error(
56
50
  `The safaridriver executable could not be found on the current PATH.
57
- Please ensure you are using Safari 10.0 or above.`);
51
+ Please ensure you are using Safari 10.0 or above.`
52
+ )
58
53
  }
59
- return exe;
54
+ return exe
60
55
  }
61
56
 
62
-
63
57
  /**
64
58
  * Creates {@link selenium-webdriver/remote.DriverService} instances that manage
65
59
  * a [safaridriver] server in a child process.
@@ -72,14 +66,13 @@ class ServiceBuilder extends remote.DriverService.Builder {
72
66
  * the builder will attempt to locate the safaridriver on the system PATH.
73
67
  */
74
68
  constructor(opt_exe) {
75
- super(opt_exe || findSafariDriver());
76
- this.setLoopback(true); // Required.
69
+ super(opt_exe || findSafariDriver())
70
+ this.setLoopback(true) // Required.
77
71
  }
78
72
  }
79
73
 
80
-
81
- const OPTIONS_CAPABILITY_KEY = 'safari.options';
82
- const TECHNOLOGY_PREVIEW_OPTIONS_KEY = 'technologyPreview';
74
+ const OPTIONS_CAPABILITY_KEY = 'safari.options'
75
+ const TECHNOLOGY_PREVIEW_OPTIONS_KEY = 'technologyPreview'
83
76
 
84
77
  /**
85
78
  * Configuration options specific to the {@link Driver SafariDriver}.
@@ -90,13 +83,13 @@ class Options extends Capabilities {
90
83
  * capabilities to initialize this instance from.
91
84
  */
92
85
  constructor(other = undefined) {
93
- super(other);
86
+ super(other)
94
87
 
95
88
  /** @private {!Object} */
96
- this.options_ = this.get(OPTIONS_CAPABILITY_KEY) || {};
89
+ this.options_ = this.get(OPTIONS_CAPABILITY_KEY) || {}
97
90
 
98
- this.set(OPTIONS_CAPABILITY_KEY, this.options_);
99
- this.setBrowserName(Browser.SAFARI);
91
+ this.set(OPTIONS_CAPABILITY_KEY, this.options_)
92
+ this.setBrowserName(Browser.SAFARI)
100
93
  }
101
94
 
102
95
  /**
@@ -107,8 +100,8 @@ class Options extends Capabilities {
107
100
  * @return {!Options} A self reference.
108
101
  */
109
102
  setTechnologyPreview(useTechnologyPreview) {
110
- this.options_[TECHNOLOGY_PREVIEW_OPTIONS_KEY] = !!useTechnologyPreview;
111
- return this;
103
+ this.options_[TECHNOLOGY_PREVIEW_OPTIONS_KEY] = !!useTechnologyPreview
104
+ return this
112
105
  }
113
106
  }
114
107
 
@@ -118,21 +111,19 @@ class Options extends Capabilities {
118
111
  */
119
112
  function useTechnologyPreview(o) {
120
113
  if (o instanceof Capabilities) {
121
- let options = o.get(OPTIONS_CAPABILITY_KEY);
122
- return !!(options && options[TECHNOLOGY_PREVIEW_OPTIONS_KEY]);
114
+ let options = o.get(OPTIONS_CAPABILITY_KEY)
115
+ return !!(options && options[TECHNOLOGY_PREVIEW_OPTIONS_KEY])
123
116
  }
124
117
 
125
118
  if (o && typeof o === 'object') {
126
- return !!o[TECHNOLOGY_PREVIEW_OPTIONS_KEY];
119
+ return !!o[TECHNOLOGY_PREVIEW_OPTIONS_KEY]
127
120
  }
128
121
 
129
- return false;
122
+ return false
130
123
  }
131
124
 
132
-
133
125
  const SAFARIDRIVER_TECHNOLOGY_PREVIEW_EXE =
134
- '/Applications/Safari Technology Preview.app/Contents/MacOS/safaridriver';
135
-
126
+ '/Applications/Safari Technology Preview.app/Contents/MacOS/safaridriver'
136
127
 
137
128
  /**
138
129
  * A WebDriver client for Safari. This class should never be instantiated
@@ -151,27 +142,27 @@ class Driver extends webdriver.WebDriver {
151
142
  * @return {!Driver} A new driver instance.
152
143
  */
153
144
  static createSession(options) {
154
- let caps = options || new Options();
145
+ let caps = options || new Options()
155
146
 
156
- let exe;
147
+ let exe
157
148
  if (useTechnologyPreview(caps.get(OPTIONS_CAPABILITY_KEY))) {
158
- exe = SAFARIDRIVER_TECHNOLOGY_PREVIEW_EXE;
149
+ exe = SAFARIDRIVER_TECHNOLOGY_PREVIEW_EXE
159
150
  }
160
151
 
161
- let service = new ServiceBuilder(exe).build();
152
+ let service = new ServiceBuilder(exe).build()
162
153
  let executor = new http.Executor(
163
- service.start().then(url => new http.HttpClient(url)));
154
+ service.start().then((url) => new http.HttpClient(url))
155
+ )
164
156
 
165
- return /** @type {!Driver} */(super.createSession(
166
- executor, caps, () => service.kill()));
157
+ return /** @type {!Driver} */ (super.createSession(executor, caps, () =>
158
+ service.kill()
159
+ ))
167
160
  }
168
161
  }
169
162
 
170
-
171
163
  // Public API
172
164
 
173
-
174
- exports.Driver = Driver;
175
- exports.Options = Options;
176
- exports.ServiceBuilder = ServiceBuilder;
177
- exports.locateSynchronously = locateSynchronously;
165
+ exports.Driver = Driver
166
+ exports.Options = Options
167
+ exports.ServiceBuilder = ServiceBuilder
168
+ exports.locateSynchronously = locateSynchronously