selenium-webdriver 3.3.0 → 4.0.0-alpha.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 +273 -0
- package/NOTICE +1 -1
- package/README.md +28 -36
- package/chrome.js +221 -146
- package/edge.js +43 -118
- package/example/chrome_android.js +8 -9
- package/example/chrome_mobile_emulation.js +9 -10
- package/example/firefox_channels.js +23 -19
- package/example/google_search.js +3 -3
- package/example/google_search_test.js +39 -27
- package/example/headless.js +55 -0
- package/example/logging.js +40 -7
- package/firefox.js +769 -0
- package/http/index.js +41 -4
- package/http/util.js +11 -6
- package/ie.js +57 -98
- package/index.js +182 -115
- package/io/index.js +59 -0
- package/io/zip.js +214 -0
- package/jasmine.json +11 -0
- package/lib/actions.js +68 -63
- package/lib/atoms/get-attribute.js +9 -0
- package/lib/atoms/is-displayed.js +73 -78
- package/lib/by.js +9 -1
- package/lib/capabilities.js +303 -201
- package/lib/command.js +28 -50
- package/lib/error.js +113 -42
- package/lib/http.js +167 -135
- package/lib/input.js +1044 -8
- package/lib/promise.js +222 -3331
- package/lib/proxy.js +134 -39
- package/lib/test/bootstrap_jasmine.js +28 -0
- package/lib/test/data/actions/click.html +24 -0
- package/lib/test/data/actions/drag.html +77 -0
- package/lib/test/data/actions/record_click.html +21 -0
- package/lib/test/data/chrome/download.html +2 -0
- package/lib/test/data/click_tests/disabled_element.html +12 -0
- package/lib/test/data/content-editable.html +10 -0
- package/lib/test/data/firefox/webextension.xpi +0 -0
- package/lib/test/data/inputs.html +42 -0
- package/lib/test/data/key_logger.html +34 -0
- package/lib/test/data/nestedElements.html +10 -1
- package/lib/test/data/scrolling_tests/page_with_partially_hidden_element.html +14 -0
- package/lib/test/data/selectPage.html +12 -0
- package/lib/test/data/simpleTest.html +5 -0
- package/lib/test/data/single_text_input.html +12 -0
- package/lib/test/data/upload_invisible.html +45 -0
- package/lib/test/fileserver.js +23 -19
- package/lib/test/index.js +30 -244
- package/lib/test/resources.js +0 -1
- package/lib/webdriver.js +770 -939
- package/net/index.js +21 -25
- package/net/portprober.js +51 -68
- package/package.json +6 -4
- package/remote/index.js +18 -30
- package/safari.js +42 -129
- package/test/actions_test.js +173 -18
- package/test/builder_test.js +106 -0
- package/test/chrome/devtools_test.js +93 -0
- package/test/chrome/options_test.js +48 -154
- package/test/chrome/service_test.js +7 -7
- package/test/cookie_test.js +77 -63
- package/test/element_finding_test.js +206 -201
- package/test/execute_script_test.js +115 -114
- package/test/fingerprint_test.js +16 -15
- package/test/firefox_test.js +251 -0
- package/test/http/http_test.js +18 -1
- package/test/http/util_test.js +2 -2
- package/test/{io_test.js → io/io_test.js} +40 -1
- package/test/io/zip_test.js +127 -0
- package/test/lib/by_test.js +21 -0
- package/test/lib/error_test.js +55 -8
- package/test/lib/http_test.js +18 -130
- package/test/lib/input_test.js +1379 -0
- package/test/lib/promise_test.js +473 -908
- package/test/lib/webdriver_test.js +357 -825
- package/test/logging_test.js +37 -43
- package/test/page_loading_test.js +70 -86
- package/test/proxy_test.js +64 -72
- package/test/rect_test.js +14 -25
- package/test/remote_test.js +13 -32
- package/test/safari_test.js +7 -71
- package/test/stale_element_test.js +20 -23
- package/test/tag_name_test.js +10 -9
- package/test/upload_test.js +27 -35
- package/test/window_test.js +72 -85
- package/testing/index.js +386 -315
- package/.npmignore +0 -2
- package/example/async_await_test.js +0 -68
- package/example/google_search_generator.js +0 -50
- package/example/parallel_flows.js +0 -54
- package/firefox/binary.js +0 -344
- package/firefox/extension.js +0 -187
- package/firefox/index.js +0 -722
- package/firefox/profile.js +0 -430
- package/lib/atoms/getAttribute.js +0 -12
- package/lib/events.js +0 -210
- package/lib/firefox/webdriver.json +0 -70
- package/lib/firefox/webdriver.xpi +0 -0
- package/lib/test/data/firefox/jetpack-sample.xpi +0 -0
- package/lib/test/data/firefox/sample.xpi +0 -0
- package/lib/test/promise.js +0 -79
- package/opera.js +0 -405
- package/phantomjs.js +0 -282
- package/test/firefox/extension_test.js +0 -96
- package/test/firefox/firefox_test.js +0 -226
- package/test/firefox/profile_test.js +0 -185
- package/test/lib/events_test.js +0 -177
- package/test/lib/promise_aplus_test.js +0 -78
- package/test/lib/promise_error_test.js +0 -884
- package/test/lib/promise_flow_test.js +0 -2288
- package/test/lib/promise_generator_test.js +0 -310
- package/test/phantomjs/execute_phantomjs_test.js +0 -59
- package/test/session_test.js +0 -54
- package/test/testing/assert_test.js +0 -373
- package/test/testing/index_test.js +0 -224
- package/testing/assert.js +0 -378
package/test/lib/http_test.js
CHANGED
|
@@ -118,7 +118,7 @@ describe('http', function() {
|
|
|
118
118
|
});
|
|
119
119
|
});
|
|
120
120
|
|
|
121
|
-
it('rejects commands missing URL parameters', function() {
|
|
121
|
+
it('rejects commands missing URL parameters', async function() {
|
|
122
122
|
let command =
|
|
123
123
|
new Command(CommandName.FIND_CHILD_ELEMENT).
|
|
124
124
|
setParameter('sessionId', 's123').
|
|
@@ -126,12 +126,13 @@ describe('http', function() {
|
|
|
126
126
|
setParameter('using', 'id').
|
|
127
127
|
setParameter('value', 'foo');
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
129
|
+
try {
|
|
130
|
+
await executor.execute(command);
|
|
131
|
+
return Promise.reject(Error('should have thrown'));
|
|
132
|
+
} catch (err) {
|
|
133
|
+
assert.strictEqual(err.constructor, error.InvalidArgumentError);
|
|
134
|
+
assert.equal(err.message, 'Missing required parameter: id');
|
|
135
|
+
}
|
|
135
136
|
assert.ok(!send.called);
|
|
136
137
|
});
|
|
137
138
|
|
|
@@ -153,14 +154,6 @@ describe('http', function() {
|
|
|
153
154
|
beforeEach(() => executor = new http.Executor(client));
|
|
154
155
|
|
|
155
156
|
describe('in legacy mode', function() {
|
|
156
|
-
test(CommandName.GET_WINDOW_SIZE, {sessionId:'s123'}, false,
|
|
157
|
-
'GET', '/session/s123/window/current/size');
|
|
158
|
-
|
|
159
|
-
test(CommandName.SET_WINDOW_SIZE,
|
|
160
|
-
{sessionId:'s123', width: 1, height: 1}, false,
|
|
161
|
-
'POST', '/session/s123/window/current/size',
|
|
162
|
-
{width: 1, height: 1});
|
|
163
|
-
|
|
164
157
|
test(CommandName.MAXIMIZE_WINDOW, {sessionId:'s123'}, false,
|
|
165
158
|
'POST', '/session/s123/window/current/maximize');
|
|
166
159
|
|
|
@@ -171,14 +164,6 @@ describe('http', function() {
|
|
|
171
164
|
});
|
|
172
165
|
|
|
173
166
|
describe('in W3C mode', function() {
|
|
174
|
-
test(CommandName.GET_WINDOW_SIZE,
|
|
175
|
-
{sessionId:'s123'}, true,
|
|
176
|
-
'GET', '/session/s123/window/size');
|
|
177
|
-
|
|
178
|
-
test(CommandName.SET_WINDOW_SIZE,
|
|
179
|
-
{sessionId:'s123', width: 1, height: 1}, true,
|
|
180
|
-
'POST', '/session/s123/window/size', {width: 1, height: 1});
|
|
181
|
-
|
|
182
167
|
test(CommandName.MAXIMIZE_WINDOW, {sessionId:'s123'}, true,
|
|
183
168
|
'POST', '/session/s123/window/maximize');
|
|
184
169
|
|
|
@@ -293,7 +278,14 @@ describe('http', function() {
|
|
|
293
278
|
});
|
|
294
279
|
|
|
295
280
|
it('auto-upgrades on W3C response', function() {
|
|
296
|
-
|
|
281
|
+
let rawResponse = {
|
|
282
|
+
value: {
|
|
283
|
+
sessionId: 's123',
|
|
284
|
+
value: {
|
|
285
|
+
name: 'Bob'
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
};
|
|
297
289
|
|
|
298
290
|
send.returns(Promise.resolve(
|
|
299
291
|
new http.Response(200, {}, JSON.stringify(rawResponse))));
|
|
@@ -344,7 +336,8 @@ describe('http', function() {
|
|
|
344
336
|
});
|
|
345
337
|
|
|
346
338
|
it('handles w3c new session failures', function() {
|
|
347
|
-
let rawResponse =
|
|
339
|
+
let rawResponse =
|
|
340
|
+
{value: {error: 'no such element', message: 'oops'}};
|
|
348
341
|
|
|
349
342
|
send.returns(Promise.resolve(
|
|
350
343
|
new http.Response(500, {}, JSON.stringify(rawResponse))));
|
|
@@ -358,111 +351,6 @@ describe('http', function() {
|
|
|
358
351
|
});
|
|
359
352
|
});
|
|
360
353
|
|
|
361
|
-
describe('extracts Session from DESCRIBE_SESSION response', function() {
|
|
362
|
-
let command;
|
|
363
|
-
|
|
364
|
-
beforeEach(function() {
|
|
365
|
-
executor = new http.Executor(client);
|
|
366
|
-
command = new Command(CommandName.DESCRIBE_SESSION)
|
|
367
|
-
.setParameter('sessionId', 'foo');
|
|
368
|
-
});
|
|
369
|
-
|
|
370
|
-
describe('fails if server returns invalid response', function() {
|
|
371
|
-
describe('(empty response)', function() {
|
|
372
|
-
test(true);
|
|
373
|
-
test(false);
|
|
374
|
-
|
|
375
|
-
function test(w3c) {
|
|
376
|
-
it('w3c === ' + w3c, function() {
|
|
377
|
-
send.returns(Promise.resolve(new http.Response(200, {}, '')));
|
|
378
|
-
executor.w3c = w3c;
|
|
379
|
-
return executor.execute(command).then(
|
|
380
|
-
() => assert.fail('expected to fail'),
|
|
381
|
-
(e) => {
|
|
382
|
-
if (!e.message.startsWith('Unable to parse')) {
|
|
383
|
-
throw e;
|
|
384
|
-
}
|
|
385
|
-
});
|
|
386
|
-
});
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
|
-
|
|
390
|
-
describe('(no session ID)', function() {
|
|
391
|
-
test(true);
|
|
392
|
-
test(false);
|
|
393
|
-
|
|
394
|
-
function test(w3c) {
|
|
395
|
-
it('w3c === ' + w3c, function() {
|
|
396
|
-
let resp = {value:{name: 'Bob'}};
|
|
397
|
-
send.returns(Promise.resolve(
|
|
398
|
-
new http.Response(200, {}, JSON.stringify(resp))));
|
|
399
|
-
executor.w3c = w3c;
|
|
400
|
-
return executor.execute(command).then(
|
|
401
|
-
() => assert.fail('expected to fail'),
|
|
402
|
-
(e) => {
|
|
403
|
-
if (!e.message.startsWith('Unable to parse')) {
|
|
404
|
-
throw e;
|
|
405
|
-
}
|
|
406
|
-
});
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
});
|
|
410
|
-
});
|
|
411
|
-
|
|
412
|
-
it('handles legacy response', function() {
|
|
413
|
-
var rawResponse = {sessionId: 's123', status: 0, value: {name: 'Bob'}};
|
|
414
|
-
|
|
415
|
-
send.returns(Promise.resolve(
|
|
416
|
-
new http.Response(200, {}, JSON.stringify(rawResponse))));
|
|
417
|
-
|
|
418
|
-
assert.ok(!executor.w3c);
|
|
419
|
-
return executor.execute(command).then(function(response) {
|
|
420
|
-
assert.ok(response instanceof Session);
|
|
421
|
-
assert.equal(response.getId(), 's123');
|
|
422
|
-
|
|
423
|
-
let caps = response.getCapabilities();
|
|
424
|
-
assert.ok(caps instanceof Capabilities);
|
|
425
|
-
assert.equal(caps.get('name'), 'Bob');
|
|
426
|
-
|
|
427
|
-
assert.ok(!executor.w3c);
|
|
428
|
-
});
|
|
429
|
-
});
|
|
430
|
-
|
|
431
|
-
it('does not auto-upgrade on W3C response', function() {
|
|
432
|
-
var rawResponse = {sessionId: 's123', value: {name: 'Bob'}};
|
|
433
|
-
|
|
434
|
-
send.returns(Promise.resolve(
|
|
435
|
-
new http.Response(200, {}, JSON.stringify(rawResponse))));
|
|
436
|
-
|
|
437
|
-
assert.ok(!executor.w3c);
|
|
438
|
-
return executor.execute(command).then(function(response) {
|
|
439
|
-
assert.ok(response instanceof Session);
|
|
440
|
-
assert.equal(response.getId(), 's123');
|
|
441
|
-
|
|
442
|
-
let caps = response.getCapabilities();
|
|
443
|
-
assert.ok(caps instanceof Capabilities);
|
|
444
|
-
assert.equal(caps.get('name'), 'Bob');
|
|
445
|
-
|
|
446
|
-
assert.ok(!executor.w3c);
|
|
447
|
-
});
|
|
448
|
-
});
|
|
449
|
-
|
|
450
|
-
it('if w3c, does not downgrade on legacy response', function() {
|
|
451
|
-
var rawResponse = {sessionId: 's123', status: 0, value: null};
|
|
452
|
-
|
|
453
|
-
send.returns(Promise.resolve(
|
|
454
|
-
new http.Response(200, {}, JSON.stringify(rawResponse))));
|
|
455
|
-
|
|
456
|
-
executor.w3c = true;
|
|
457
|
-
return executor.execute(command).then(function(response) {
|
|
458
|
-
assert.ok(response instanceof Session);
|
|
459
|
-
assert.equal(response.getId(), 's123');
|
|
460
|
-
assert.equal(response.getCapabilities().size, 0);
|
|
461
|
-
assert.ok(executor.w3c, 'should never downgrade');
|
|
462
|
-
});
|
|
463
|
-
});
|
|
464
|
-
});
|
|
465
|
-
|
|
466
354
|
it('handles JSON null', function() {
|
|
467
355
|
var command = new Command(CommandName.GET_CURRENT_URL)
|
|
468
356
|
.setParameter('sessionId', 's123');
|