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.
- package/CHANGES.md +35 -1
- package/LICENSE +1 -1
- package/NOTICE +1 -1
- package/README.md +4 -4
- package/chrome.js +72 -592
- package/chromium.js +829 -0
- package/devtools/CDPConnection.js +37 -0
- package/edge.js +124 -86
- package/example/chrome_android.js +16 -13
- package/example/chrome_mobile_emulation.js +18 -14
- package/example/firefox_channels.js +35 -28
- package/example/google_search.js +9 -9
- package/example/google_search_test.js +20 -22
- package/example/headless.js +27 -19
- package/example/logging.js +34 -38
- package/firefox.js +200 -200
- package/http/index.js +131 -115
- package/http/util.js +56 -64
- package/ie.js +180 -104
- package/index.js +246 -199
- package/io/exec.js +34 -39
- package/io/index.js +142 -152
- package/io/zip.js +75 -65
- package/lib/actions.js +140 -122
- package/lib/atoms/find-elements.js +124 -0
- package/lib/atoms/get-attribute.js +79 -59
- package/lib/atoms/is-displayed.js +72 -73
- package/lib/atoms/mutation-listener.js +38 -0
- package/lib/by.js +192 -65
- package/lib/capabilities.js +82 -78
- package/lib/command.js +20 -20
- package/lib/error.js +134 -168
- package/lib/http.js +337 -230
- package/lib/input.js +325 -302
- package/lib/logging.js +127 -138
- package/lib/promise.js +60 -66
- 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 +1024 -541
- package/net/index.js +30 -36
- package/net/portprober.js +31 -144
- package/opera.js +406 -0
- package/package.json +19 -12
- package/proxy.js +2 -2
- package/remote/index.js +190 -187
- package/safari.js +40 -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
|
-
|
|
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)
|
|
69
|
+
super(opt_exe || findSafariDriver())
|
|
70
|
+
this.setLoopback(true) // Required.
|
|
77
71
|
}
|
|
78
72
|
}
|
|
79
73
|
|
|
80
|
-
|
|
81
|
-
const
|
|
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
|
-
|
|
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
|
-
|
|
154
|
+
service.start().then((url) => new http.HttpClient(url))
|
|
155
|
+
)
|
|
164
156
|
|
|
165
|
-
return /** @type {!Driver} */(super.createSession(
|
|
166
|
-
|
|
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.
|
|
175
|
-
exports.
|
|
176
|
-
exports.
|
|
177
|
-
exports.locateSynchronously = locateSynchronously;
|
|
165
|
+
exports.Driver = Driver
|
|
166
|
+
exports.Options = Options
|
|
167
|
+
exports.ServiceBuilder = ServiceBuilder
|
|
168
|
+
exports.locateSynchronously = locateSynchronously
|