UrgentcareCLI 0.1.1 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/UrgentCare/CLI.rb +1 -2
- data/lib/UrgentCare/Scraper.rb +65 -0
- data/lib/UrgentCare/version.rb +2 -2
- data/lib/UrgentCare.rb +1 -0
- metadata +3 -313
- data/.gitignore +0 -11
- data/.rspec +0 -3
- data/.travis.yml +0 -5
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -12
- data/Gemfile.lock +0 -84
- data/LICENSE.txt +0 -21
- data/Notes +0 -41
- data/README.md +0 -41
- data/Rakefile +0 -8
- data/UrgentCare.gemspec +0 -39
- data/background.jpg +0 -0
- data/data.txt +0 -4
- data/lib/Urgentcare/Scraper.rb +0 -78
- data/node_modules/.bin/rimraf +0 -1
- data/node_modules/.package-lock.json +0 -250
- data/node_modules/balanced-match/.github/FUNDING.yml +0 -2
- data/node_modules/balanced-match/LICENSE.md +0 -21
- data/node_modules/balanced-match/README.md +0 -97
- data/node_modules/balanced-match/index.js +0 -62
- data/node_modules/balanced-match/package.json +0 -48
- data/node_modules/brace-expansion/LICENSE +0 -21
- data/node_modules/brace-expansion/README.md +0 -129
- data/node_modules/brace-expansion/index.js +0 -201
- data/node_modules/brace-expansion/package.json +0 -47
- data/node_modules/concat-map/.travis.yml +0 -4
- data/node_modules/concat-map/LICENSE +0 -18
- data/node_modules/concat-map/README.markdown +0 -62
- data/node_modules/concat-map/example/map.js +0 -6
- data/node_modules/concat-map/index.js +0 -13
- data/node_modules/concat-map/package.json +0 -43
- data/node_modules/concat-map/test/map.js +0 -39
- data/node_modules/core-util-is/LICENSE +0 -19
- data/node_modules/core-util-is/README.md +0 -3
- data/node_modules/core-util-is/float.patch +0 -604
- data/node_modules/core-util-is/lib/util.js +0 -107
- data/node_modules/core-util-is/package.json +0 -32
- data/node_modules/core-util-is/test.js +0 -68
- data/node_modules/fs.realpath/LICENSE +0 -43
- data/node_modules/fs.realpath/README.md +0 -33
- data/node_modules/fs.realpath/index.js +0 -66
- data/node_modules/fs.realpath/old.js +0 -303
- data/node_modules/fs.realpath/package.json +0 -26
- data/node_modules/glob/LICENSE +0 -21
- data/node_modules/glob/README.md +0 -375
- data/node_modules/glob/changelog.md +0 -67
- data/node_modules/glob/common.js +0 -234
- data/node_modules/glob/glob.js +0 -788
- data/node_modules/glob/package.json +0 -51
- data/node_modules/glob/sync.js +0 -484
- data/node_modules/immediate/LICENSE.txt +0 -20
- data/node_modules/immediate/README.md +0 -93
- data/node_modules/immediate/dist/immediate.js +0 -75
- data/node_modules/immediate/dist/immediate.min.js +0 -1
- data/node_modules/immediate/lib/browser.js +0 -69
- data/node_modules/immediate/lib/index.js +0 -73
- data/node_modules/immediate/package.json +0 -42
- data/node_modules/inflight/LICENSE +0 -15
- data/node_modules/inflight/README.md +0 -37
- data/node_modules/inflight/inflight.js +0 -54
- data/node_modules/inflight/package.json +0 -29
- data/node_modules/inherits/LICENSE +0 -16
- data/node_modules/inherits/README.md +0 -42
- data/node_modules/inherits/inherits.js +0 -9
- data/node_modules/inherits/inherits_browser.js +0 -27
- data/node_modules/inherits/package.json +0 -29
- data/node_modules/isarray/.npmignore +0 -1
- data/node_modules/isarray/.travis.yml +0 -4
- data/node_modules/isarray/Makefile +0 -6
- data/node_modules/isarray/README.md +0 -60
- data/node_modules/isarray/component.json +0 -19
- data/node_modules/isarray/index.js +0 -5
- data/node_modules/isarray/package.json +0 -45
- data/node_modules/isarray/test.js +0 -20
- data/node_modules/jszip/.codeclimate.yml +0 -16
- data/node_modules/jszip/.editorconfig +0 -8
- data/node_modules/jszip/.jshintignore +0 -1
- data/node_modules/jszip/.jshintrc +0 -21
- data/node_modules/jszip/.travis.yml +0 -17
- data/node_modules/jszip/CHANGES.md +0 -163
- data/node_modules/jszip/LICENSE.markdown +0 -651
- data/node_modules/jszip/README.markdown +0 -35
- data/node_modules/jszip/dist/jszip.js +0 -30
- data/node_modules/jszip/dist/jszip.min.js +0 -13
- data/node_modules/jszip/index.d.ts +0 -270
- data/node_modules/jszip/lib/base64.js +0 -106
- data/node_modules/jszip/lib/compressedObject.js +0 -74
- data/node_modules/jszip/lib/compressions.js +0 -14
- data/node_modules/jszip/lib/crc32.js +0 -77
- data/node_modules/jszip/lib/defaults.js +0 -11
- data/node_modules/jszip/lib/external.js +0 -19
- data/node_modules/jszip/lib/flate.js +0 -85
- data/node_modules/jszip/lib/generate/ZipFileWorker.js +0 -540
- data/node_modules/jszip/lib/generate/index.js +0 -57
- data/node_modules/jszip/lib/index.js +0 -52
- data/node_modules/jszip/lib/license_header.js +0 -11
- data/node_modules/jszip/lib/load.js +0 -81
- data/node_modules/jszip/lib/nodejs/NodejsStreamInputAdapter.js +0 -74
- data/node_modules/jszip/lib/nodejs/NodejsStreamOutputAdapter.js +0 -42
- data/node_modules/jszip/lib/nodejsUtils.js +0 -57
- data/node_modules/jszip/lib/object.js +0 -389
- data/node_modules/jszip/lib/readable-stream-browser.js +0 -9
- data/node_modules/jszip/lib/reader/ArrayReader.js +0 -57
- data/node_modules/jszip/lib/reader/DataReader.js +0 -116
- data/node_modules/jszip/lib/reader/NodeBufferReader.js +0 -19
- data/node_modules/jszip/lib/reader/StringReader.js +0 -38
- data/node_modules/jszip/lib/reader/Uint8ArrayReader.js +0 -22
- data/node_modules/jszip/lib/reader/readerFor.js +0 -28
- data/node_modules/jszip/lib/signature.js +0 -7
- data/node_modules/jszip/lib/stream/ConvertWorker.js +0 -26
- data/node_modules/jszip/lib/stream/Crc32Probe.js +0 -24
- data/node_modules/jszip/lib/stream/DataLengthProbe.js +0 -29
- data/node_modules/jszip/lib/stream/DataWorker.js +0 -116
- data/node_modules/jszip/lib/stream/GenericWorker.js +0 -263
- data/node_modules/jszip/lib/stream/StreamHelper.js +0 -212
- data/node_modules/jszip/lib/support.js +0 -38
- data/node_modules/jszip/lib/utf8.js +0 -275
- data/node_modules/jszip/lib/utils.js +0 -476
- data/node_modules/jszip/lib/zipEntries.js +0 -262
- data/node_modules/jszip/lib/zipEntry.js +0 -294
- data/node_modules/jszip/lib/zipObject.js +0 -133
- data/node_modules/jszip/package.json +0 -63
- data/node_modules/jszip/vendor/FileSaver.js +0 -247
- data/node_modules/lie/README.md +0 -62
- data/node_modules/lie/dist/lie.js +0 -350
- data/node_modules/lie/dist/lie.min.js +0 -1
- data/node_modules/lie/dist/lie.polyfill.js +0 -358
- data/node_modules/lie/dist/lie.polyfill.min.js +0 -1
- data/node_modules/lie/lib/browser.js +0 -273
- data/node_modules/lie/lib/index.js +0 -298
- data/node_modules/lie/license.md +0 -7
- data/node_modules/lie/lie.d.ts +0 -244
- data/node_modules/lie/package.json +0 -69
- data/node_modules/lie/polyfill.js +0 -4
- data/node_modules/minimatch/LICENSE +0 -15
- data/node_modules/minimatch/README.md +0 -209
- data/node_modules/minimatch/minimatch.js +0 -923
- data/node_modules/minimatch/package.json +0 -30
- data/node_modules/once/LICENSE +0 -15
- data/node_modules/once/README.md +0 -79
- data/node_modules/once/once.js +0 -42
- data/node_modules/once/package.json +0 -33
- data/node_modules/pako/CHANGELOG.md +0 -164
- data/node_modules/pako/LICENSE +0 -21
- data/node_modules/pako/README.md +0 -191
- data/node_modules/pako/dist/pako.js +0 -6818
- data/node_modules/pako/dist/pako.min.js +0 -1
- data/node_modules/pako/dist/pako_deflate.js +0 -3997
- data/node_modules/pako/dist/pako_deflate.min.js +0 -1
- data/node_modules/pako/dist/pako_inflate.js +0 -3300
- data/node_modules/pako/dist/pako_inflate.min.js +0 -1
- data/node_modules/pako/index.js +0 -14
- data/node_modules/pako/lib/deflate.js +0 -400
- data/node_modules/pako/lib/inflate.js +0 -423
- data/node_modules/pako/lib/utils/common.js +0 -105
- data/node_modules/pako/lib/utils/strings.js +0 -187
- data/node_modules/pako/lib/zlib/README +0 -59
- data/node_modules/pako/lib/zlib/adler32.js +0 -51
- data/node_modules/pako/lib/zlib/constants.js +0 -68
- data/node_modules/pako/lib/zlib/crc32.js +0 -59
- data/node_modules/pako/lib/zlib/deflate.js +0 -1874
- data/node_modules/pako/lib/zlib/gzheader.js +0 -58
- data/node_modules/pako/lib/zlib/inffast.js +0 -345
- data/node_modules/pako/lib/zlib/inflate.js +0 -1556
- data/node_modules/pako/lib/zlib/inftrees.js +0 -343
- data/node_modules/pako/lib/zlib/messages.js +0 -32
- data/node_modules/pako/lib/zlib/trees.js +0 -1222
- data/node_modules/pako/lib/zlib/zstream.js +0 -47
- data/node_modules/pako/package.json +0 -44
- data/node_modules/path-is-absolute/index.js +0 -20
- data/node_modules/path-is-absolute/license +0 -21
- data/node_modules/path-is-absolute/package.json +0 -43
- data/node_modules/path-is-absolute/readme.md +0 -59
- data/node_modules/process-nextick-args/index.js +0 -45
- data/node_modules/process-nextick-args/license.md +0 -19
- data/node_modules/process-nextick-args/package.json +0 -25
- data/node_modules/process-nextick-args/readme.md +0 -18
- data/node_modules/readable-stream/.travis.yml +0 -34
- data/node_modules/readable-stream/CONTRIBUTING.md +0 -38
- data/node_modules/readable-stream/GOVERNANCE.md +0 -136
- data/node_modules/readable-stream/LICENSE +0 -47
- data/node_modules/readable-stream/README.md +0 -58
- data/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
- data/node_modules/readable-stream/duplex-browser.js +0 -1
- data/node_modules/readable-stream/duplex.js +0 -1
- data/node_modules/readable-stream/lib/_stream_duplex.js +0 -131
- data/node_modules/readable-stream/lib/_stream_passthrough.js +0 -47
- data/node_modules/readable-stream/lib/_stream_readable.js +0 -1019
- data/node_modules/readable-stream/lib/_stream_transform.js +0 -214
- data/node_modules/readable-stream/lib/_stream_writable.js +0 -687
- data/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -79
- data/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -74
- data/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
- data/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
- data/node_modules/readable-stream/package.json +0 -52
- data/node_modules/readable-stream/passthrough.js +0 -1
- data/node_modules/readable-stream/readable-browser.js +0 -7
- data/node_modules/readable-stream/readable.js +0 -19
- data/node_modules/readable-stream/transform.js +0 -1
- data/node_modules/readable-stream/writable-browser.js +0 -1
- data/node_modules/readable-stream/writable.js +0 -8
- data/node_modules/rimraf/LICENSE +0 -15
- data/node_modules/rimraf/README.md +0 -101
- data/node_modules/rimraf/bin.js +0 -50
- data/node_modules/rimraf/package.json +0 -29
- data/node_modules/rimraf/rimraf.js +0 -372
- data/node_modules/safe-buffer/LICENSE +0 -21
- data/node_modules/safe-buffer/README.md +0 -584
- data/node_modules/safe-buffer/index.d.ts +0 -187
- data/node_modules/safe-buffer/index.js +0 -62
- data/node_modules/safe-buffer/package.json +0 -37
- data/node_modules/selenium-webdriver/CHANGES.md +0 -1114
- data/node_modules/selenium-webdriver/LICENSE +0 -202
- data/node_modules/selenium-webdriver/NOTICE +0 -2
- data/node_modules/selenium-webdriver/README.md +0 -229
- data/node_modules/selenium-webdriver/chrome.js +0 -295
- data/node_modules/selenium-webdriver/chromium.js +0 -829
- data/node_modules/selenium-webdriver/devtools/CDPConnection.js +0 -35
- data/node_modules/selenium-webdriver/edge.js +0 -224
- data/node_modules/selenium-webdriver/example/chrome_android.js +0 -45
- data/node_modules/selenium-webdriver/example/chrome_mobile_emulation.js +0 -46
- data/node_modules/selenium-webdriver/example/firefox_channels.js +0 -84
- data/node_modules/selenium-webdriver/example/google_search.js +0 -50
- data/node_modules/selenium-webdriver/example/google_search_test.js +0 -70
- data/node_modules/selenium-webdriver/example/headless.js +0 -63
- data/node_modules/selenium-webdriver/example/logging.js +0 -64
- data/node_modules/selenium-webdriver/firefox.js +0 -789
- data/node_modules/selenium-webdriver/http/index.js +0 -324
- data/node_modules/selenium-webdriver/http/util.js +0 -172
- data/node_modules/selenium-webdriver/ie.js +0 -503
- data/node_modules/selenium-webdriver/index.js +0 -825
- data/node_modules/selenium-webdriver/io/exec.js +0 -162
- data/node_modules/selenium-webdriver/io/index.js +0 -348
- data/node_modules/selenium-webdriver/io/zip.js +0 -223
- data/node_modules/selenium-webdriver/lib/atoms/find-elements.js +0 -123
- data/node_modules/selenium-webdriver/lib/atoms/get-attribute.js +0 -101
- data/node_modules/selenium-webdriver/lib/atoms/is-displayed.js +0 -101
- data/node_modules/selenium-webdriver/lib/atoms/mutation-listener.js +0 -55
- data/node_modules/selenium-webdriver/lib/by.js +0 -415
- data/node_modules/selenium-webdriver/lib/capabilities.js +0 -553
- data/node_modules/selenium-webdriver/lib/command.js +0 -206
- data/node_modules/selenium-webdriver/lib/error.js +0 -605
- data/node_modules/selenium-webdriver/lib/http.js +0 -704
- data/node_modules/selenium-webdriver/lib/input.js +0 -946
- data/node_modules/selenium-webdriver/lib/logging.js +0 -661
- data/node_modules/selenium-webdriver/lib/promise.js +0 -285
- data/node_modules/selenium-webdriver/lib/proxy.js +0 -212
- data/node_modules/selenium-webdriver/lib/session.js +0 -77
- data/node_modules/selenium-webdriver/lib/symbols.js +0 -37
- data/node_modules/selenium-webdriver/lib/until.js +0 -429
- data/node_modules/selenium-webdriver/lib/webdriver.js +0 -2919
- data/node_modules/selenium-webdriver/net/index.js +0 -107
- data/node_modules/selenium-webdriver/net/portprober.js +0 -75
- data/node_modules/selenium-webdriver/opera.js +0 -406
- data/node_modules/selenium-webdriver/package.json +0 -54
- data/node_modules/selenium-webdriver/proxy.js +0 -32
- data/node_modules/selenium-webdriver/remote/index.js +0 -624
- data/node_modules/selenium-webdriver/safari.js +0 -168
- data/node_modules/selenium-webdriver/testing/index.js +0 -504
- data/node_modules/set-immediate-shim/index.js +0 -7
- data/node_modules/set-immediate-shim/package.json +0 -34
- data/node_modules/set-immediate-shim/readme.md +0 -31
- data/node_modules/string_decoder/.travis.yml +0 -50
- data/node_modules/string_decoder/LICENSE +0 -48
- data/node_modules/string_decoder/README.md +0 -47
- data/node_modules/string_decoder/lib/string_decoder.js +0 -296
- data/node_modules/string_decoder/package.json +0 -31
- data/node_modules/tmp/CHANGELOG.md +0 -288
- data/node_modules/tmp/LICENSE +0 -21
- data/node_modules/tmp/README.md +0 -365
- data/node_modules/tmp/lib/tmp.js +0 -780
- data/node_modules/tmp/node_modules/.bin/rimraf +0 -1
- data/node_modules/tmp/node_modules/rimraf/CHANGELOG.md +0 -65
- data/node_modules/tmp/node_modules/rimraf/LICENSE +0 -15
- data/node_modules/tmp/node_modules/rimraf/README.md +0 -101
- data/node_modules/tmp/node_modules/rimraf/bin.js +0 -68
- data/node_modules/tmp/node_modules/rimraf/package.json +0 -32
- data/node_modules/tmp/node_modules/rimraf/rimraf.js +0 -360
- data/node_modules/tmp/package.json +0 -58
- data/node_modules/util-deprecate/History.md +0 -16
- data/node_modules/util-deprecate/LICENSE +0 -24
- data/node_modules/util-deprecate/README.md +0 -53
- data/node_modules/util-deprecate/browser.js +0 -67
- data/node_modules/util-deprecate/node.js +0 -6
- data/node_modules/util-deprecate/package.json +0 -27
- data/node_modules/wrappy/LICENSE +0 -15
- data/node_modules/wrappy/README.md +0 -36
- data/node_modules/wrappy/package.json +0 -29
- data/node_modules/wrappy/wrappy.js +0 -33
- data/node_modules/ws/LICENSE +0 -21
- data/node_modules/ws/README.md +0 -496
- data/node_modules/ws/browser.js +0 -8
- data/node_modules/ws/index.js +0 -10
- data/node_modules/ws/lib/buffer-util.js +0 -129
- data/node_modules/ws/lib/constants.js +0 -10
- data/node_modules/ws/lib/event-target.js +0 -184
- data/node_modules/ws/lib/extension.js +0 -223
- data/node_modules/ws/lib/limiter.js +0 -55
- data/node_modules/ws/lib/permessage-deflate.js +0 -517
- data/node_modules/ws/lib/receiver.js +0 -507
- data/node_modules/ws/lib/sender.js +0 -405
- data/node_modules/ws/lib/stream.js +0 -165
- data/node_modules/ws/lib/validation.js +0 -104
- data/node_modules/ws/lib/websocket-server.js +0 -418
- data/node_modules/ws/lib/websocket.js +0 -942
- data/node_modules/ws/package.json +0 -56
- data/package-lock.json +0 -458
- data/package.json +0 -5
- data/selenium.log +0 -1
- data/spec.md +0 -6
- data/test.data +0 -2110
@@ -1,829 +0,0 @@
|
|
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 Defines an abstract {@linkplain Driver WebDriver} client for
|
20
|
-
* Chromium-based web browsers. These classes should not be instantiated
|
21
|
-
* directly.
|
22
|
-
*
|
23
|
-
* There are three primary classes exported by this module:
|
24
|
-
*
|
25
|
-
* 1. {@linkplain ServiceBuilder}: configures the
|
26
|
-
* {@link selenium-webdriver/remote.DriverService remote.DriverService}
|
27
|
-
* that manages a WebDriver server child process.
|
28
|
-
*
|
29
|
-
* 2. {@linkplain Options}: defines configuration options for each new Chromium
|
30
|
-
* session, such as which {@linkplain Options#setProxy proxy} to use,
|
31
|
-
* what {@linkplain Options#addExtensions extensions} to install, or
|
32
|
-
* what {@linkplain Options#addArguments command-line switches} to use when
|
33
|
-
* starting the browser.
|
34
|
-
*
|
35
|
-
* 3. {@linkplain Driver}: the WebDriver client; each new instance will control
|
36
|
-
* a unique browser session with a clean user profile (unless otherwise
|
37
|
-
* configured through the {@link Options} class).
|
38
|
-
*
|
39
|
-
* __Headless Chromium__ <a id="headless"></a>
|
40
|
-
*
|
41
|
-
* To start the browser in headless mode, simply call
|
42
|
-
* {@linkplain Options#headless Options.headless()}.
|
43
|
-
*
|
44
|
-
* let chrome = require('selenium-webdriver/chrome');
|
45
|
-
* let {Builder} = require('selenium-webdriver');
|
46
|
-
*
|
47
|
-
* let driver = new Builder()
|
48
|
-
* .forBrowser('chrome')
|
49
|
-
* .setChromeOptions(new chrome.Options().headless())
|
50
|
-
* .build();
|
51
|
-
*
|
52
|
-
* __Customizing the Chromium WebDriver Server__ <a id="custom-server"></a>
|
53
|
-
*
|
54
|
-
* Subclasses of {@link Driver} are expected to provide a static
|
55
|
-
* getDefaultService method. By default, this method will be called every time
|
56
|
-
* a {@link Driver} instance is created to obtain the default driver service
|
57
|
-
* for that specific browser (e.g. Chrome or Chromium Edge). Subclasses are
|
58
|
-
* responsible for managing the lifetime of the default service.
|
59
|
-
*
|
60
|
-
* You may also create a {@link Driver} with its own driver service. This is
|
61
|
-
* useful if you need to capture the server's log output for a specific session:
|
62
|
-
*
|
63
|
-
* let chrome = require('selenium-webdriver/chrome');
|
64
|
-
*
|
65
|
-
* let service = new chrome.ServiceBuilder()
|
66
|
-
* .loggingTo('/my/log/file.txt')
|
67
|
-
* .enableVerboseLogging()
|
68
|
-
* .build();
|
69
|
-
*
|
70
|
-
* let options = new chrome.Options();
|
71
|
-
* // configure browser options ...
|
72
|
-
*
|
73
|
-
* let driver = chrome.Driver.createSession(options, service);
|
74
|
-
*/
|
75
|
-
|
76
|
-
'use strict'
|
77
|
-
|
78
|
-
const http = require('./http')
|
79
|
-
const io = require('./io')
|
80
|
-
const { Capabilities, Capability } = require('./lib/capabilities')
|
81
|
-
const command = require('./lib/command')
|
82
|
-
const error = require('./lib/error')
|
83
|
-
const Symbols = require('./lib/symbols')
|
84
|
-
const webdriver = require('./lib/webdriver')
|
85
|
-
const remote = require('./remote')
|
86
|
-
|
87
|
-
/**
|
88
|
-
* Custom command names supported by Chromium WebDriver.
|
89
|
-
* @enum {string}
|
90
|
-
*/
|
91
|
-
const Command = {
|
92
|
-
LAUNCH_APP: 'launchApp',
|
93
|
-
GET_NETWORK_CONDITIONS: 'getNetworkConditions',
|
94
|
-
SET_NETWORK_CONDITIONS: 'setNetworkConditions',
|
95
|
-
SEND_DEVTOOLS_COMMAND: 'sendDevToolsCommand',
|
96
|
-
SEND_AND_GET_DEVTOOLS_COMMAND: 'sendAndGetDevToolsCommand',
|
97
|
-
SET_PERMISSION: 'setPermission',
|
98
|
-
GET_CAST_SINKS: 'getCastSinks',
|
99
|
-
SET_CAST_SINK_TO_USE: 'setCastSinkToUse',
|
100
|
-
START_CAST_TAB_MIRRORING: 'setCastTabMirroring',
|
101
|
-
GET_CAST_ISSUE_MESSAGE: 'getCastIssueMessage',
|
102
|
-
STOP_CASTING: 'stopCasting',
|
103
|
-
}
|
104
|
-
|
105
|
-
/**
|
106
|
-
* Creates a command executor with support for Chromium's custom commands.
|
107
|
-
* @param {!Promise<string>} url The server's URL.
|
108
|
-
* @return {!command.Executor} The new command executor.
|
109
|
-
*/
|
110
|
-
function createExecutor(url, vendorPrefix) {
|
111
|
-
const agent = new http.Agent({ keepAlive: true })
|
112
|
-
const client = url.then((url) => new http.HttpClient(url, agent))
|
113
|
-
const executor = new http.Executor(client)
|
114
|
-
configureExecutor(executor, vendorPrefix)
|
115
|
-
return executor
|
116
|
-
}
|
117
|
-
|
118
|
-
/**
|
119
|
-
* Configures the given executor with Chromium-specific commands.
|
120
|
-
* @param {!http.Executor} executor the executor to configure.
|
121
|
-
*/
|
122
|
-
function configureExecutor(executor, vendorPrefix) {
|
123
|
-
executor.defineCommand(
|
124
|
-
Command.LAUNCH_APP,
|
125
|
-
'POST',
|
126
|
-
'/session/:sessionId/chromium/launch_app'
|
127
|
-
)
|
128
|
-
executor.defineCommand(
|
129
|
-
Command.GET_NETWORK_CONDITIONS,
|
130
|
-
'GET',
|
131
|
-
'/session/:sessionId/chromium/network_conditions'
|
132
|
-
)
|
133
|
-
executor.defineCommand(
|
134
|
-
Command.SET_NETWORK_CONDITIONS,
|
135
|
-
'POST',
|
136
|
-
'/session/:sessionId/chromium/network_conditions'
|
137
|
-
)
|
138
|
-
executor.defineCommand(
|
139
|
-
Command.SEND_DEVTOOLS_COMMAND,
|
140
|
-
'POST',
|
141
|
-
'/session/:sessionId/chromium/send_command'
|
142
|
-
)
|
143
|
-
executor.defineCommand(
|
144
|
-
Command.SEND_AND_GET_DEVTOOLS_COMMAND,
|
145
|
-
'POST',
|
146
|
-
'/session/:sessionId/chromium/send_command_and_get_result'
|
147
|
-
)
|
148
|
-
executor.defineCommand(
|
149
|
-
Command.SET_PERMISSION,
|
150
|
-
'POST',
|
151
|
-
'/session/:sessionId/permissions'
|
152
|
-
)
|
153
|
-
executor.defineCommand(
|
154
|
-
Command.GET_CAST_SINKS,
|
155
|
-
'GET',
|
156
|
-
`/session/:sessionId/${vendorPrefix}/cast/get_sinks`
|
157
|
-
)
|
158
|
-
executor.defineCommand(
|
159
|
-
Command.SET_CAST_SINK_TO_USE,
|
160
|
-
'POST',
|
161
|
-
`/session/:sessionId/${vendorPrefix}/cast/set_sink_to_use`
|
162
|
-
)
|
163
|
-
executor.defineCommand(
|
164
|
-
Command.START_CAST_TAB_MIRRORING,
|
165
|
-
'POST',
|
166
|
-
`/session/:sessionId/${vendorPrefix}/cast/start_tab_mirroring`
|
167
|
-
)
|
168
|
-
executor.defineCommand(
|
169
|
-
Command.GET_CAST_ISSUE_MESSAGE,
|
170
|
-
'GET',
|
171
|
-
`/session/:sessionId/${vendorPrefix}/cast/get_issue_message`
|
172
|
-
)
|
173
|
-
executor.defineCommand(
|
174
|
-
Command.STOP_CASTING,
|
175
|
-
'POST',
|
176
|
-
`/session/:sessionId/${vendorPrefix}/cast/stop_casting`
|
177
|
-
)
|
178
|
-
}
|
179
|
-
|
180
|
-
/**
|
181
|
-
* Creates {@link selenium-webdriver/remote.DriverService} instances that manage
|
182
|
-
* a WebDriver server in a child process.
|
183
|
-
*/
|
184
|
-
class ServiceBuilder extends remote.DriverService.Builder {
|
185
|
-
/**
|
186
|
-
* @param {string=} exe Path to the server executable to use. Subclasses
|
187
|
-
* should ensure a valid path to the appropriate exe is provided.
|
188
|
-
*/
|
189
|
-
constructor(exe) {
|
190
|
-
super(exe)
|
191
|
-
this.setLoopback(true) // Required
|
192
|
-
}
|
193
|
-
|
194
|
-
/**
|
195
|
-
* Sets which port adb is listening to. _The driver will connect to adb
|
196
|
-
* if an {@linkplain Options#androidPackage Android session} is requested, but
|
197
|
-
* adb **must** be started beforehand._
|
198
|
-
*
|
199
|
-
* @param {number} port Which port adb is running on.
|
200
|
-
* @return {!ServiceBuilder} A self reference.
|
201
|
-
*/
|
202
|
-
setAdbPort(port) {
|
203
|
-
return this.addArguments('--adb-port=' + port)
|
204
|
-
}
|
205
|
-
|
206
|
-
/**
|
207
|
-
* Sets the path of the log file the driver should log to. If a log file is
|
208
|
-
* not specified, the driver will log to stderr.
|
209
|
-
* @param {string} path Path of the log file to use.
|
210
|
-
* @return {!ServiceBuilder} A self reference.
|
211
|
-
*/
|
212
|
-
loggingTo(path) {
|
213
|
-
return this.addArguments('--log-path=' + path)
|
214
|
-
}
|
215
|
-
|
216
|
-
/**
|
217
|
-
* Enables verbose logging.
|
218
|
-
* @return {!ServiceBuilder} A self reference.
|
219
|
-
*/
|
220
|
-
enableVerboseLogging() {
|
221
|
-
return this.addArguments('--verbose')
|
222
|
-
}
|
223
|
-
|
224
|
-
/**
|
225
|
-
* Sets the number of threads the driver should use to manage HTTP requests.
|
226
|
-
* By default, the driver will use 4 threads.
|
227
|
-
* @param {number} n The number of threads to use.
|
228
|
-
* @return {!ServiceBuilder} A self reference.
|
229
|
-
*/
|
230
|
-
setNumHttpThreads(n) {
|
231
|
-
return this.addArguments('--http-threads=' + n)
|
232
|
-
}
|
233
|
-
|
234
|
-
/**
|
235
|
-
* @override
|
236
|
-
*/
|
237
|
-
setPath(path) {
|
238
|
-
super.setPath(path)
|
239
|
-
return this.addArguments('--url-base=' + path)
|
240
|
-
}
|
241
|
-
}
|
242
|
-
|
243
|
-
/**
|
244
|
-
* Class for managing WebDriver options specific to a Chromium-based browser.
|
245
|
-
*/
|
246
|
-
class Options extends Capabilities {
|
247
|
-
/**
|
248
|
-
* @param {(Capabilities|Map<string, ?>|Object)=} other Another set of
|
249
|
-
* capabilities to initialize this instance from.
|
250
|
-
*/
|
251
|
-
constructor(other = undefined) {
|
252
|
-
super(other)
|
253
|
-
|
254
|
-
/** @private {!Object} */
|
255
|
-
this.options_ = this.get(this.CAPABILITY_KEY) || {}
|
256
|
-
|
257
|
-
this.setBrowserName(this.BROWSER_NAME_VALUE)
|
258
|
-
this.set(this.CAPABILITY_KEY, this.options_)
|
259
|
-
}
|
260
|
-
|
261
|
-
/**
|
262
|
-
* Add additional command line arguments to use when launching the browser.
|
263
|
-
* Each argument may be specified with or without the "--" prefix
|
264
|
-
* (e.g. "--foo" and "foo"). Arguments with an associated value should be
|
265
|
-
* delimited by an "=": "foo=bar".
|
266
|
-
*
|
267
|
-
* @param {...(string|!Array<string>)} args The arguments to add.
|
268
|
-
* @return {!Options} A self reference.
|
269
|
-
*/
|
270
|
-
addArguments(...args) {
|
271
|
-
let newArgs = (this.options_.args || []).concat(...args)
|
272
|
-
if (newArgs.length) {
|
273
|
-
this.options_.args = newArgs
|
274
|
-
}
|
275
|
-
return this
|
276
|
-
}
|
277
|
-
|
278
|
-
/**
|
279
|
-
* Configures the driver to start the browser in headless mode.
|
280
|
-
*
|
281
|
-
* > __NOTE:__ Resizing the browser window in headless mode is only supported
|
282
|
-
* > in Chromium 60+. Users are encouraged to set an initial window size with
|
283
|
-
* > the {@link #windowSize windowSize({width, height})} option.
|
284
|
-
*
|
285
|
-
* > __NOTE__: For security, Chromium disables downloads by default when
|
286
|
-
* > in headless mode (to prevent sites from silently downloading files to
|
287
|
-
* > your machine). After creating a session, you may call
|
288
|
-
* > {@link ./chrome.Driver#setDownloadPath setDownloadPath} to re-enable
|
289
|
-
* > downloads, saving files in the specified directory.
|
290
|
-
*
|
291
|
-
* @return {!Options} A self reference.
|
292
|
-
*/
|
293
|
-
headless() {
|
294
|
-
return this.addArguments('headless')
|
295
|
-
}
|
296
|
-
|
297
|
-
/**
|
298
|
-
* Sets the initial window size.
|
299
|
-
*
|
300
|
-
* @param {{width: number, height: number}} size The desired window size.
|
301
|
-
* @return {!Options} A self reference.
|
302
|
-
* @throws {TypeError} if width or height is unspecified, not a number, or
|
303
|
-
* less than or equal to 0.
|
304
|
-
*/
|
305
|
-
windowSize({ width, height }) {
|
306
|
-
function checkArg(arg) {
|
307
|
-
if (typeof arg !== 'number' || arg <= 0) {
|
308
|
-
throw TypeError('Arguments must be {width, height} with numbers > 0')
|
309
|
-
}
|
310
|
-
}
|
311
|
-
checkArg(width)
|
312
|
-
checkArg(height)
|
313
|
-
return this.addArguments(`window-size=${width},${height}`)
|
314
|
-
}
|
315
|
-
|
316
|
-
/**
|
317
|
-
* List of Chrome command line switches to exclude that ChromeDriver by default
|
318
|
-
* passes when starting Chrome. Do not prefix switches with "--".
|
319
|
-
*
|
320
|
-
* @param {...(string|!Array<string>)} args The switches to exclude.
|
321
|
-
* @return {!Options} A self reference.
|
322
|
-
*/
|
323
|
-
excludeSwitches(...args) {
|
324
|
-
let switches = (this.options_.excludeSwitches || []).concat(...args)
|
325
|
-
if (switches.length) {
|
326
|
-
this.options_.excludeSwitches = switches
|
327
|
-
}
|
328
|
-
return this
|
329
|
-
}
|
330
|
-
|
331
|
-
/**
|
332
|
-
* Add additional extensions to install when launching the browser. Each extension
|
333
|
-
* should be specified as the path to the packed CRX file, or a Buffer for an
|
334
|
-
* extension.
|
335
|
-
* @param {...(string|!Buffer|!Array<(string|!Buffer)>)} args The
|
336
|
-
* extensions to add.
|
337
|
-
* @return {!Options} A self reference.
|
338
|
-
*/
|
339
|
-
addExtensions(...args) {
|
340
|
-
let current = this.options_.extensions || []
|
341
|
-
this.options_.extensions = current.concat(...args)
|
342
|
-
return this
|
343
|
-
}
|
344
|
-
|
345
|
-
/**
|
346
|
-
* Sets the path to the browser binary to use. On Mac OS X, this path should
|
347
|
-
* reference the actual Chromium executable, not just the application binary
|
348
|
-
* (e.g. "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome").
|
349
|
-
*
|
350
|
-
* The binary path can be absolute or relative to the WebDriver server
|
351
|
-
* executable, but it must exist on the machine that will launch the browser.
|
352
|
-
*
|
353
|
-
* @param {string} path The path to the browser binary to use.
|
354
|
-
* @return {!Options} A self reference.
|
355
|
-
*/
|
356
|
-
setBinaryPath(path) {
|
357
|
-
this.options_.binary = path
|
358
|
-
return this
|
359
|
-
}
|
360
|
-
|
361
|
-
/**
|
362
|
-
* Sets whether to leave the started browser process running if the controlling
|
363
|
-
* driver service is killed before {@link webdriver.WebDriver#quit()} is
|
364
|
-
* called.
|
365
|
-
* @param {boolean} detach Whether to leave the browser running if the
|
366
|
-
* driver service is killed before the session.
|
367
|
-
* @return {!Options} A self reference.
|
368
|
-
*/
|
369
|
-
detachDriver(detach) {
|
370
|
-
this.options_.detach = detach
|
371
|
-
return this
|
372
|
-
}
|
373
|
-
|
374
|
-
/**
|
375
|
-
* Sets the user preferences for Chrome's user profile. See the "Preferences"
|
376
|
-
* file in Chrome's user data directory for examples.
|
377
|
-
* @param {!Object} prefs Dictionary of user preferences to use.
|
378
|
-
* @return {!Options} A self reference.
|
379
|
-
*/
|
380
|
-
setUserPreferences(prefs) {
|
381
|
-
this.options_.prefs = prefs
|
382
|
-
return this
|
383
|
-
}
|
384
|
-
|
385
|
-
/**
|
386
|
-
* Sets the performance logging preferences. Options include:
|
387
|
-
*
|
388
|
-
* - `enableNetwork`: Whether or not to collect events from Network domain.
|
389
|
-
* - `enablePage`: Whether or not to collect events from Page domain.
|
390
|
-
* - `enableTimeline`: Whether or not to collect events from Timeline domain.
|
391
|
-
* Note: when tracing is enabled, Timeline domain is implicitly disabled,
|
392
|
-
* unless `enableTimeline` is explicitly set to true.
|
393
|
-
* - `traceCategories`: A comma-separated string of Chromium tracing
|
394
|
-
* categories for which trace events should be collected. An unspecified
|
395
|
-
* or empty string disables tracing.
|
396
|
-
* - `bufferUsageReportingInterval`: The requested number of milliseconds
|
397
|
-
* between DevTools trace buffer usage events. For example, if 1000, then
|
398
|
-
* once per second, DevTools will report how full the trace buffer is. If
|
399
|
-
* a report indicates the buffer usage is 100%, a warning will be issued.
|
400
|
-
*
|
401
|
-
* @param {{enableNetwork: boolean,
|
402
|
-
* enablePage: boolean,
|
403
|
-
* enableTimeline: boolean,
|
404
|
-
* traceCategories: string,
|
405
|
-
* bufferUsageReportingInterval: number}} prefs The performance
|
406
|
-
* logging preferences.
|
407
|
-
* @return {!Options} A self reference.
|
408
|
-
*/
|
409
|
-
setPerfLoggingPrefs(prefs) {
|
410
|
-
this.options_.perfLoggingPrefs = prefs
|
411
|
-
return this
|
412
|
-
}
|
413
|
-
|
414
|
-
/**
|
415
|
-
* Sets preferences for the "Local State" file in Chrome's user data
|
416
|
-
* directory.
|
417
|
-
* @param {!Object} state Dictionary of local state preferences.
|
418
|
-
* @return {!Options} A self reference.
|
419
|
-
*/
|
420
|
-
setLocalState(state) {
|
421
|
-
this.options_.localState = state
|
422
|
-
return this
|
423
|
-
}
|
424
|
-
|
425
|
-
/**
|
426
|
-
* Sets the name of the activity hosting a Chrome-based Android WebView. This
|
427
|
-
* option must be set to connect to an [Android WebView](
|
428
|
-
* https://chromedriver.chromium.org/getting-started/getting-started---android)
|
429
|
-
*
|
430
|
-
* @param {string} name The activity name.
|
431
|
-
* @return {!Options} A self reference.
|
432
|
-
*/
|
433
|
-
androidActivity(name) {
|
434
|
-
this.options_.androidActivity = name
|
435
|
-
return this
|
436
|
-
}
|
437
|
-
|
438
|
-
/**
|
439
|
-
* Sets the device serial number to connect to via ADB. If not specified, the
|
440
|
-
* WebDriver server will select an unused device at random. An error will be
|
441
|
-
* returned if all devices already have active sessions.
|
442
|
-
*
|
443
|
-
* @param {string} serial The device serial number to connect to.
|
444
|
-
* @return {!Options} A self reference.
|
445
|
-
*/
|
446
|
-
androidDeviceSerial(serial) {
|
447
|
-
this.options_.androidDeviceSerial = serial
|
448
|
-
return this
|
449
|
-
}
|
450
|
-
|
451
|
-
/**
|
452
|
-
* Sets the package name of the Chrome or WebView app.
|
453
|
-
*
|
454
|
-
* @param {?string} pkg The package to connect to, or `null` to disable Android
|
455
|
-
* and switch back to using desktop browser.
|
456
|
-
* @return {!Options} A self reference.
|
457
|
-
*/
|
458
|
-
androidPackage(pkg) {
|
459
|
-
this.options_.androidPackage = pkg
|
460
|
-
return this
|
461
|
-
}
|
462
|
-
|
463
|
-
/**
|
464
|
-
* Sets the process name of the Activity hosting the WebView (as given by
|
465
|
-
* `ps`). If not specified, the process name is assumed to be the same as
|
466
|
-
* {@link #androidPackage}.
|
467
|
-
*
|
468
|
-
* @param {string} processName The main activity name.
|
469
|
-
* @return {!Options} A self reference.
|
470
|
-
*/
|
471
|
-
androidProcess(processName) {
|
472
|
-
this.options_.androidProcess = processName
|
473
|
-
return this
|
474
|
-
}
|
475
|
-
|
476
|
-
/**
|
477
|
-
* Sets whether to connect to an already-running instead of the specified
|
478
|
-
* {@linkplain #androidProcess app} instead of launching the app with a clean
|
479
|
-
* data directory.
|
480
|
-
*
|
481
|
-
* @param {boolean} useRunning Whether to connect to a running instance.
|
482
|
-
* @return {!Options} A self reference.
|
483
|
-
*/
|
484
|
-
androidUseRunningApp(useRunning) {
|
485
|
-
this.options_.androidUseRunningApp = useRunning
|
486
|
-
return this
|
487
|
-
}
|
488
|
-
|
489
|
-
/**
|
490
|
-
* Sets the path to the browser's log file. This path should exist on the machine
|
491
|
-
* that will launch the browser.
|
492
|
-
* @param {string} path Path to the log file to use.
|
493
|
-
* @return {!Options} A self reference.
|
494
|
-
*/
|
495
|
-
setBrowserLogFile(path) {
|
496
|
-
this.options_.logPath = path
|
497
|
-
return this
|
498
|
-
}
|
499
|
-
|
500
|
-
/**
|
501
|
-
* Sets the directory to store browser minidumps in. This option is only
|
502
|
-
* supported when the driver is running on Linux.
|
503
|
-
* @param {string} path The directory path.
|
504
|
-
* @return {!Options} A self reference.
|
505
|
-
*/
|
506
|
-
setBrowserMinidumpPath(path) {
|
507
|
-
this.options_.minidumpPath = path
|
508
|
-
return this
|
509
|
-
}
|
510
|
-
|
511
|
-
/**
|
512
|
-
* Configures the browser to emulate a mobile device. For more information, refer
|
513
|
-
* to the ChromeDriver project page on [mobile emulation][em]. Configuration
|
514
|
-
* options include:
|
515
|
-
*
|
516
|
-
* - `deviceName`: The name of a pre-configured [emulated device][devem]
|
517
|
-
* - `width`: screen width, in pixels
|
518
|
-
* - `height`: screen height, in pixels
|
519
|
-
* - `pixelRatio`: screen pixel ratio
|
520
|
-
*
|
521
|
-
* __Example 1: Using a Pre-configured Device__
|
522
|
-
*
|
523
|
-
* let options = new chrome.Options().setMobileEmulation(
|
524
|
-
* {deviceName: 'Google Nexus 5'});
|
525
|
-
*
|
526
|
-
* let driver = chrome.Driver.createSession(options);
|
527
|
-
*
|
528
|
-
* __Example 2: Using Custom Screen Configuration__
|
529
|
-
*
|
530
|
-
* let options = new chrome.Options().setMobileEmulation({deviceMetrics: {
|
531
|
-
* width: 360,
|
532
|
-
* height: 640,
|
533
|
-
* pixelRatio: 3.0
|
534
|
-
* }});
|
535
|
-
*
|
536
|
-
* let driver = chrome.Driver.createSession(options);
|
537
|
-
*
|
538
|
-
*
|
539
|
-
* [em]: https://chromedriver.chromium.org/mobile-emulation
|
540
|
-
* [devem]: https://developer.chrome.com/devtools/docs/device-mode
|
541
|
-
*
|
542
|
-
* @param {?({deviceName: string}|
|
543
|
-
* {width: number, height: number, pixelRatio: number})} config The
|
544
|
-
* mobile emulation configuration, or `null` to disable emulation.
|
545
|
-
* @return {!Options} A self reference.
|
546
|
-
*/
|
547
|
-
setMobileEmulation(config) {
|
548
|
-
this.options_.mobileEmulation = config
|
549
|
-
return this
|
550
|
-
}
|
551
|
-
|
552
|
-
/**
|
553
|
-
* Converts this instance to its JSON wire protocol representation. Note this
|
554
|
-
* function is an implementation not intended for general use.
|
555
|
-
*
|
556
|
-
* @return {!Object} The JSON wire protocol representation of this instance.
|
557
|
-
* @suppress {checkTypes} Suppress [] access on a struct.
|
558
|
-
*/
|
559
|
-
[Symbols.serialize]() {
|
560
|
-
if (this.options_.extensions && this.options_.extensions.length) {
|
561
|
-
this.options_.extensions = this.options_.extensions.map(function (
|
562
|
-
extension
|
563
|
-
) {
|
564
|
-
if (Buffer.isBuffer(extension)) {
|
565
|
-
return extension.toString('base64')
|
566
|
-
}
|
567
|
-
return io
|
568
|
-
.read(/** @type {string} */(extension))
|
569
|
-
.then((buffer) => buffer.toString('base64'))
|
570
|
-
})
|
571
|
-
}
|
572
|
-
return super[Symbols.serialize]()
|
573
|
-
}
|
574
|
-
}
|
575
|
-
|
576
|
-
/**
|
577
|
-
* Creates a new WebDriver client for Chromium-based browsers.
|
578
|
-
*/
|
579
|
-
class Driver extends webdriver.WebDriver {
|
580
|
-
/**
|
581
|
-
* Creates a new session with the WebDriver server.
|
582
|
-
*
|
583
|
-
* @param {(Capabilities|Options)=} opt_config The configuration options.
|
584
|
-
* @param {(remote.DriverService|http.Executor)=} opt_serviceExecutor Either
|
585
|
-
* a DriverService to use for the remote end, or a preconfigured executor
|
586
|
-
* for an externally managed endpoint. If neither is provided, the
|
587
|
-
* {@linkplain ##getDefaultService default service} will be used by
|
588
|
-
* default.
|
589
|
-
* @return {!Driver} A new driver instance.
|
590
|
-
*/
|
591
|
-
static createSession(caps, opt_serviceExecutor) {
|
592
|
-
let executor
|
593
|
-
let onQuit
|
594
|
-
if (opt_serviceExecutor instanceof http.Executor) {
|
595
|
-
executor = opt_serviceExecutor
|
596
|
-
configureExecutor(executor, this.VENDOR_COMMAND_PREFIX)
|
597
|
-
} else {
|
598
|
-
let service = opt_serviceExecutor || this.getDefaultService()
|
599
|
-
executor = createExecutor(service.start(), this.VENDOR_COMMAND_PREFIX)
|
600
|
-
onQuit = () => service.kill()
|
601
|
-
}
|
602
|
-
|
603
|
-
// W3C spec requires noProxy value to be an array of strings, but Chromium
|
604
|
-
// expects a single host as a string.
|
605
|
-
let proxy = caps.get(Capability.PROXY)
|
606
|
-
if (proxy && Array.isArray(proxy.noProxy)) {
|
607
|
-
proxy.noProxy = proxy.noProxy[0]
|
608
|
-
if (!proxy.noProxy) {
|
609
|
-
proxy.noProxy = undefined
|
610
|
-
}
|
611
|
-
}
|
612
|
-
|
613
|
-
return /** @type {!Driver} */ (super.createSession(executor, caps, onQuit))
|
614
|
-
}
|
615
|
-
|
616
|
-
/**
|
617
|
-
* This function is a no-op as file detectors are not supported by this
|
618
|
-
* implementation.
|
619
|
-
* @override
|
620
|
-
*/
|
621
|
-
setFileDetector() { }
|
622
|
-
|
623
|
-
/**
|
624
|
-
* Schedules a command to launch Chrome App with given ID.
|
625
|
-
* @param {string} id ID of the App to launch.
|
626
|
-
* @return {!Promise<void>} A promise that will be resolved
|
627
|
-
* when app is launched.
|
628
|
-
*/
|
629
|
-
launchApp(id) {
|
630
|
-
return this.execute(
|
631
|
-
new command.Command(Command.LAUNCH_APP).setParameter('id', id)
|
632
|
-
)
|
633
|
-
}
|
634
|
-
|
635
|
-
/**
|
636
|
-
* Schedules a command to get Chromium network emulation settings.
|
637
|
-
* @return {!Promise} A promise that will be resolved when network
|
638
|
-
* emulation settings are retrievied.
|
639
|
-
*/
|
640
|
-
getNetworkConditions() {
|
641
|
-
return this.execute(new command.Command(Command.GET_NETWORK_CONDITIONS))
|
642
|
-
}
|
643
|
-
|
644
|
-
/**
|
645
|
-
* Schedules a command to set Chromium network emulation settings.
|
646
|
-
*
|
647
|
-
* __Sample Usage:__
|
648
|
-
*
|
649
|
-
* driver.setNetworkConditions({
|
650
|
-
* offline: false,
|
651
|
-
* latency: 5, // Additional latency (ms).
|
652
|
-
* download_throughput: 500 * 1024, // Maximal aggregated download throughput.
|
653
|
-
* upload_throughput: 500 * 1024 // Maximal aggregated upload throughput.
|
654
|
-
* });
|
655
|
-
*
|
656
|
-
* @param {Object} spec Defines the network conditions to set
|
657
|
-
* @return {!Promise<void>} A promise that will be resolved when network
|
658
|
-
* emulation settings are set.
|
659
|
-
*/
|
660
|
-
setNetworkConditions(spec) {
|
661
|
-
if (!spec || typeof spec !== 'object') {
|
662
|
-
throw TypeError(
|
663
|
-
'setNetworkConditions called with non-network-conditions parameter'
|
664
|
-
)
|
665
|
-
}
|
666
|
-
return this.execute(
|
667
|
-
new command.Command(Command.SET_NETWORK_CONDITIONS).setParameter(
|
668
|
-
'network_conditions',
|
669
|
-
spec
|
670
|
-
)
|
671
|
-
)
|
672
|
-
}
|
673
|
-
|
674
|
-
/**
|
675
|
-
* Sends an arbitrary devtools command to the browser.
|
676
|
-
*
|
677
|
-
* @param {string} cmd The name of the command to send.
|
678
|
-
* @param {Object=} params The command parameters.
|
679
|
-
* @return {!Promise<void>} A promise that will be resolved when the command
|
680
|
-
* has finished.
|
681
|
-
* @see <https://chromedevtools.github.io/devtools-protocol/>
|
682
|
-
*/
|
683
|
-
sendDevToolsCommand(cmd, params = {}) {
|
684
|
-
return this.execute(
|
685
|
-
new command.Command(Command.SEND_DEVTOOLS_COMMAND)
|
686
|
-
.setParameter('cmd', cmd)
|
687
|
-
.setParameter('params', params)
|
688
|
-
)
|
689
|
-
}
|
690
|
-
|
691
|
-
/**
|
692
|
-
* ends an arbitrary devtools command to the browser and get the result.
|
693
|
-
*
|
694
|
-
* @param {string} cmd The name of the command to send.
|
695
|
-
* @param {Object=} params The command parameters.
|
696
|
-
* @return {!Promise<void>} A promise that will be resolved when the command
|
697
|
-
* has finished.
|
698
|
-
* @see <https://chromedevtools.github.io/devtools-protocol/>
|
699
|
-
*/
|
700
|
-
sendAndGetDevToolsCommand(cmd, params = {}) {
|
701
|
-
return this.execute(
|
702
|
-
new command.Command(Command.SEND_AND_GET_DEVTOOLS_COMMAND)
|
703
|
-
.setParameter('cmd', cmd)
|
704
|
-
.setParameter('params', params)
|
705
|
-
)
|
706
|
-
}
|
707
|
-
|
708
|
-
/**
|
709
|
-
* Set a permission state to the given value.
|
710
|
-
*
|
711
|
-
* @param {string} name A name of the permission to update.
|
712
|
-
* @param {('granted'|'denied'|'prompt')} state State to set permission to.
|
713
|
-
* @returns {!Promise<Object>} A promise that will be resolved when the
|
714
|
-
* command has finished.
|
715
|
-
* @see <https://w3c.github.io/permissions/#permission-registry> for valid
|
716
|
-
* names
|
717
|
-
*/
|
718
|
-
setPermission(name, state) {
|
719
|
-
return this.execute(
|
720
|
-
new command.Command(Command.SET_PERMISSION)
|
721
|
-
.setParameter('descriptor', { name })
|
722
|
-
.setParameter('state', state)
|
723
|
-
)
|
724
|
-
}
|
725
|
-
|
726
|
-
/**
|
727
|
-
* Sends a DevTools command to change the browser's download directory.
|
728
|
-
*
|
729
|
-
* @param {string} path The desired download directory.
|
730
|
-
* @return {!Promise<void>} A promise that will be resolved when the command
|
731
|
-
* has finished.
|
732
|
-
* @see #sendDevToolsCommand
|
733
|
-
*/
|
734
|
-
async setDownloadPath(path) {
|
735
|
-
if (!path || typeof path !== 'string') {
|
736
|
-
throw new error.InvalidArgumentError('invalid download path')
|
737
|
-
}
|
738
|
-
const stat = await io.stat(path)
|
739
|
-
if (!stat.isDirectory()) {
|
740
|
-
throw new error.InvalidArgumentError('not a directory: ' + path)
|
741
|
-
}
|
742
|
-
return this.sendDevToolsCommand('Page.setDownloadBehavior', {
|
743
|
-
behavior: 'allow',
|
744
|
-
downloadPath: path,
|
745
|
-
})
|
746
|
-
}
|
747
|
-
|
748
|
-
/**
|
749
|
-
* Returns the list of cast sinks (Cast devices) available to the Chrome media router.
|
750
|
-
*
|
751
|
-
* @return {!promise.Thenable<void>} A promise that will be resolved with an array of Strings
|
752
|
-
* containing the friendly device names of available cast sink targets.
|
753
|
-
*/
|
754
|
-
getCastSinks() {
|
755
|
-
return this.schedule(
|
756
|
-
new command.Command(Command.GET_CAST_SINKS),
|
757
|
-
'Driver.getCastSinks()'
|
758
|
-
)
|
759
|
-
}
|
760
|
-
|
761
|
-
/**
|
762
|
-
* Selects a cast sink (Cast device) as the recipient of media router intents (connect or play).
|
763
|
-
*
|
764
|
-
* @param {String} deviceName name of the target device.
|
765
|
-
* @return {!promise.Thenable<void>} A promise that will be resolved
|
766
|
-
* when the target device has been selected to respond further webdriver commands.
|
767
|
-
*/
|
768
|
-
setCastSinkToUse(deviceName) {
|
769
|
-
return this.schedule(
|
770
|
-
new command.Command(Command.SET_CAST_SINK_TO_USE).setParameter(
|
771
|
-
'sinkName',
|
772
|
-
deviceName
|
773
|
-
),
|
774
|
-
'Driver.setCastSinkToUse(' + deviceName + ')'
|
775
|
-
)
|
776
|
-
}
|
777
|
-
|
778
|
-
/**
|
779
|
-
* Initiates tab mirroring for the current browser tab on the specified device.
|
780
|
-
*
|
781
|
-
* @param {String} deviceName name of the target device.
|
782
|
-
* @return {!promise.Thenable<void>} A promise that will be resolved
|
783
|
-
* when the mirror command has been issued to the device.
|
784
|
-
*/
|
785
|
-
startCastTabMirroring(deviceName) {
|
786
|
-
return this.schedule(
|
787
|
-
new command.Command(Command.START_CAST_TAB_MIRRORING).setParameter(
|
788
|
-
'sinkName',
|
789
|
-
deviceName
|
790
|
-
),
|
791
|
-
'Driver.startCastTabMirroring(' + deviceName + ')'
|
792
|
-
)
|
793
|
-
}
|
794
|
-
|
795
|
-
/**
|
796
|
-
* Returns an error message when there is any issue in a Cast session.
|
797
|
-
* @return {!promise.Thenable<void>} A promise that will be resolved
|
798
|
-
* when the mirror command has been issued to the device.
|
799
|
-
*/
|
800
|
-
getCastIssueMessage() {
|
801
|
-
return this.schedule(
|
802
|
-
new command.Command(Command.GET_CAST_ISSUE_MESSAGE),
|
803
|
-
'Driver.getCastIssueMessage()'
|
804
|
-
)
|
805
|
-
}
|
806
|
-
|
807
|
-
/**
|
808
|
-
* Stops casting from media router to the specified device, if connected.
|
809
|
-
*
|
810
|
-
* @param {String} deviceName name of the target device.
|
811
|
-
* @return {!promise.Thenable<void>} A promise that will be resolved
|
812
|
-
* when the stop command has been issued to the device.
|
813
|
-
*/
|
814
|
-
stopCasting(deviceName) {
|
815
|
-
return this.schedule(
|
816
|
-
new command.Command(Command.STOP_CASTING).setParameter(
|
817
|
-
'sinkName',
|
818
|
-
deviceName
|
819
|
-
),
|
820
|
-
'Driver.stopCasting(' + deviceName + ')'
|
821
|
-
)
|
822
|
-
}
|
823
|
-
}
|
824
|
-
|
825
|
-
// PUBLIC API
|
826
|
-
|
827
|
-
exports.Driver = Driver
|
828
|
-
exports.Options = Options
|
829
|
-
exports.ServiceBuilder = ServiceBuilder
|