UrgentcareCLI 0.1.1 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (317) hide show
  1. checksums.yaml +4 -4
  2. data/lib/UrgentCare/CLI.rb +1 -2
  3. data/lib/UrgentCare/Scraper.rb +65 -0
  4. data/lib/UrgentCare/version.rb +2 -2
  5. data/lib/UrgentCare.rb +1 -0
  6. metadata +3 -313
  7. data/.gitignore +0 -11
  8. data/.rspec +0 -3
  9. data/.travis.yml +0 -5
  10. data/CODE_OF_CONDUCT.md +0 -74
  11. data/Gemfile +0 -12
  12. data/Gemfile.lock +0 -84
  13. data/LICENSE.txt +0 -21
  14. data/Notes +0 -41
  15. data/README.md +0 -41
  16. data/Rakefile +0 -8
  17. data/UrgentCare.gemspec +0 -39
  18. data/background.jpg +0 -0
  19. data/data.txt +0 -4
  20. data/lib/Urgentcare/Scraper.rb +0 -78
  21. data/node_modules/.bin/rimraf +0 -1
  22. data/node_modules/.package-lock.json +0 -250
  23. data/node_modules/balanced-match/.github/FUNDING.yml +0 -2
  24. data/node_modules/balanced-match/LICENSE.md +0 -21
  25. data/node_modules/balanced-match/README.md +0 -97
  26. data/node_modules/balanced-match/index.js +0 -62
  27. data/node_modules/balanced-match/package.json +0 -48
  28. data/node_modules/brace-expansion/LICENSE +0 -21
  29. data/node_modules/brace-expansion/README.md +0 -129
  30. data/node_modules/brace-expansion/index.js +0 -201
  31. data/node_modules/brace-expansion/package.json +0 -47
  32. data/node_modules/concat-map/.travis.yml +0 -4
  33. data/node_modules/concat-map/LICENSE +0 -18
  34. data/node_modules/concat-map/README.markdown +0 -62
  35. data/node_modules/concat-map/example/map.js +0 -6
  36. data/node_modules/concat-map/index.js +0 -13
  37. data/node_modules/concat-map/package.json +0 -43
  38. data/node_modules/concat-map/test/map.js +0 -39
  39. data/node_modules/core-util-is/LICENSE +0 -19
  40. data/node_modules/core-util-is/README.md +0 -3
  41. data/node_modules/core-util-is/float.patch +0 -604
  42. data/node_modules/core-util-is/lib/util.js +0 -107
  43. data/node_modules/core-util-is/package.json +0 -32
  44. data/node_modules/core-util-is/test.js +0 -68
  45. data/node_modules/fs.realpath/LICENSE +0 -43
  46. data/node_modules/fs.realpath/README.md +0 -33
  47. data/node_modules/fs.realpath/index.js +0 -66
  48. data/node_modules/fs.realpath/old.js +0 -303
  49. data/node_modules/fs.realpath/package.json +0 -26
  50. data/node_modules/glob/LICENSE +0 -21
  51. data/node_modules/glob/README.md +0 -375
  52. data/node_modules/glob/changelog.md +0 -67
  53. data/node_modules/glob/common.js +0 -234
  54. data/node_modules/glob/glob.js +0 -788
  55. data/node_modules/glob/package.json +0 -51
  56. data/node_modules/glob/sync.js +0 -484
  57. data/node_modules/immediate/LICENSE.txt +0 -20
  58. data/node_modules/immediate/README.md +0 -93
  59. data/node_modules/immediate/dist/immediate.js +0 -75
  60. data/node_modules/immediate/dist/immediate.min.js +0 -1
  61. data/node_modules/immediate/lib/browser.js +0 -69
  62. data/node_modules/immediate/lib/index.js +0 -73
  63. data/node_modules/immediate/package.json +0 -42
  64. data/node_modules/inflight/LICENSE +0 -15
  65. data/node_modules/inflight/README.md +0 -37
  66. data/node_modules/inflight/inflight.js +0 -54
  67. data/node_modules/inflight/package.json +0 -29
  68. data/node_modules/inherits/LICENSE +0 -16
  69. data/node_modules/inherits/README.md +0 -42
  70. data/node_modules/inherits/inherits.js +0 -9
  71. data/node_modules/inherits/inherits_browser.js +0 -27
  72. data/node_modules/inherits/package.json +0 -29
  73. data/node_modules/isarray/.npmignore +0 -1
  74. data/node_modules/isarray/.travis.yml +0 -4
  75. data/node_modules/isarray/Makefile +0 -6
  76. data/node_modules/isarray/README.md +0 -60
  77. data/node_modules/isarray/component.json +0 -19
  78. data/node_modules/isarray/index.js +0 -5
  79. data/node_modules/isarray/package.json +0 -45
  80. data/node_modules/isarray/test.js +0 -20
  81. data/node_modules/jszip/.codeclimate.yml +0 -16
  82. data/node_modules/jszip/.editorconfig +0 -8
  83. data/node_modules/jszip/.jshintignore +0 -1
  84. data/node_modules/jszip/.jshintrc +0 -21
  85. data/node_modules/jszip/.travis.yml +0 -17
  86. data/node_modules/jszip/CHANGES.md +0 -163
  87. data/node_modules/jszip/LICENSE.markdown +0 -651
  88. data/node_modules/jszip/README.markdown +0 -35
  89. data/node_modules/jszip/dist/jszip.js +0 -30
  90. data/node_modules/jszip/dist/jszip.min.js +0 -13
  91. data/node_modules/jszip/index.d.ts +0 -270
  92. data/node_modules/jszip/lib/base64.js +0 -106
  93. data/node_modules/jszip/lib/compressedObject.js +0 -74
  94. data/node_modules/jszip/lib/compressions.js +0 -14
  95. data/node_modules/jszip/lib/crc32.js +0 -77
  96. data/node_modules/jszip/lib/defaults.js +0 -11
  97. data/node_modules/jszip/lib/external.js +0 -19
  98. data/node_modules/jszip/lib/flate.js +0 -85
  99. data/node_modules/jszip/lib/generate/ZipFileWorker.js +0 -540
  100. data/node_modules/jszip/lib/generate/index.js +0 -57
  101. data/node_modules/jszip/lib/index.js +0 -52
  102. data/node_modules/jszip/lib/license_header.js +0 -11
  103. data/node_modules/jszip/lib/load.js +0 -81
  104. data/node_modules/jszip/lib/nodejs/NodejsStreamInputAdapter.js +0 -74
  105. data/node_modules/jszip/lib/nodejs/NodejsStreamOutputAdapter.js +0 -42
  106. data/node_modules/jszip/lib/nodejsUtils.js +0 -57
  107. data/node_modules/jszip/lib/object.js +0 -389
  108. data/node_modules/jszip/lib/readable-stream-browser.js +0 -9
  109. data/node_modules/jszip/lib/reader/ArrayReader.js +0 -57
  110. data/node_modules/jszip/lib/reader/DataReader.js +0 -116
  111. data/node_modules/jszip/lib/reader/NodeBufferReader.js +0 -19
  112. data/node_modules/jszip/lib/reader/StringReader.js +0 -38
  113. data/node_modules/jszip/lib/reader/Uint8ArrayReader.js +0 -22
  114. data/node_modules/jszip/lib/reader/readerFor.js +0 -28
  115. data/node_modules/jszip/lib/signature.js +0 -7
  116. data/node_modules/jszip/lib/stream/ConvertWorker.js +0 -26
  117. data/node_modules/jszip/lib/stream/Crc32Probe.js +0 -24
  118. data/node_modules/jszip/lib/stream/DataLengthProbe.js +0 -29
  119. data/node_modules/jszip/lib/stream/DataWorker.js +0 -116
  120. data/node_modules/jszip/lib/stream/GenericWorker.js +0 -263
  121. data/node_modules/jszip/lib/stream/StreamHelper.js +0 -212
  122. data/node_modules/jszip/lib/support.js +0 -38
  123. data/node_modules/jszip/lib/utf8.js +0 -275
  124. data/node_modules/jszip/lib/utils.js +0 -476
  125. data/node_modules/jszip/lib/zipEntries.js +0 -262
  126. data/node_modules/jszip/lib/zipEntry.js +0 -294
  127. data/node_modules/jszip/lib/zipObject.js +0 -133
  128. data/node_modules/jszip/package.json +0 -63
  129. data/node_modules/jszip/vendor/FileSaver.js +0 -247
  130. data/node_modules/lie/README.md +0 -62
  131. data/node_modules/lie/dist/lie.js +0 -350
  132. data/node_modules/lie/dist/lie.min.js +0 -1
  133. data/node_modules/lie/dist/lie.polyfill.js +0 -358
  134. data/node_modules/lie/dist/lie.polyfill.min.js +0 -1
  135. data/node_modules/lie/lib/browser.js +0 -273
  136. data/node_modules/lie/lib/index.js +0 -298
  137. data/node_modules/lie/license.md +0 -7
  138. data/node_modules/lie/lie.d.ts +0 -244
  139. data/node_modules/lie/package.json +0 -69
  140. data/node_modules/lie/polyfill.js +0 -4
  141. data/node_modules/minimatch/LICENSE +0 -15
  142. data/node_modules/minimatch/README.md +0 -209
  143. data/node_modules/minimatch/minimatch.js +0 -923
  144. data/node_modules/minimatch/package.json +0 -30
  145. data/node_modules/once/LICENSE +0 -15
  146. data/node_modules/once/README.md +0 -79
  147. data/node_modules/once/once.js +0 -42
  148. data/node_modules/once/package.json +0 -33
  149. data/node_modules/pako/CHANGELOG.md +0 -164
  150. data/node_modules/pako/LICENSE +0 -21
  151. data/node_modules/pako/README.md +0 -191
  152. data/node_modules/pako/dist/pako.js +0 -6818
  153. data/node_modules/pako/dist/pako.min.js +0 -1
  154. data/node_modules/pako/dist/pako_deflate.js +0 -3997
  155. data/node_modules/pako/dist/pako_deflate.min.js +0 -1
  156. data/node_modules/pako/dist/pako_inflate.js +0 -3300
  157. data/node_modules/pako/dist/pako_inflate.min.js +0 -1
  158. data/node_modules/pako/index.js +0 -14
  159. data/node_modules/pako/lib/deflate.js +0 -400
  160. data/node_modules/pako/lib/inflate.js +0 -423
  161. data/node_modules/pako/lib/utils/common.js +0 -105
  162. data/node_modules/pako/lib/utils/strings.js +0 -187
  163. data/node_modules/pako/lib/zlib/README +0 -59
  164. data/node_modules/pako/lib/zlib/adler32.js +0 -51
  165. data/node_modules/pako/lib/zlib/constants.js +0 -68
  166. data/node_modules/pako/lib/zlib/crc32.js +0 -59
  167. data/node_modules/pako/lib/zlib/deflate.js +0 -1874
  168. data/node_modules/pako/lib/zlib/gzheader.js +0 -58
  169. data/node_modules/pako/lib/zlib/inffast.js +0 -345
  170. data/node_modules/pako/lib/zlib/inflate.js +0 -1556
  171. data/node_modules/pako/lib/zlib/inftrees.js +0 -343
  172. data/node_modules/pako/lib/zlib/messages.js +0 -32
  173. data/node_modules/pako/lib/zlib/trees.js +0 -1222
  174. data/node_modules/pako/lib/zlib/zstream.js +0 -47
  175. data/node_modules/pako/package.json +0 -44
  176. data/node_modules/path-is-absolute/index.js +0 -20
  177. data/node_modules/path-is-absolute/license +0 -21
  178. data/node_modules/path-is-absolute/package.json +0 -43
  179. data/node_modules/path-is-absolute/readme.md +0 -59
  180. data/node_modules/process-nextick-args/index.js +0 -45
  181. data/node_modules/process-nextick-args/license.md +0 -19
  182. data/node_modules/process-nextick-args/package.json +0 -25
  183. data/node_modules/process-nextick-args/readme.md +0 -18
  184. data/node_modules/readable-stream/.travis.yml +0 -34
  185. data/node_modules/readable-stream/CONTRIBUTING.md +0 -38
  186. data/node_modules/readable-stream/GOVERNANCE.md +0 -136
  187. data/node_modules/readable-stream/LICENSE +0 -47
  188. data/node_modules/readable-stream/README.md +0 -58
  189. data/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
  190. data/node_modules/readable-stream/duplex-browser.js +0 -1
  191. data/node_modules/readable-stream/duplex.js +0 -1
  192. data/node_modules/readable-stream/lib/_stream_duplex.js +0 -131
  193. data/node_modules/readable-stream/lib/_stream_passthrough.js +0 -47
  194. data/node_modules/readable-stream/lib/_stream_readable.js +0 -1019
  195. data/node_modules/readable-stream/lib/_stream_transform.js +0 -214
  196. data/node_modules/readable-stream/lib/_stream_writable.js +0 -687
  197. data/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -79
  198. data/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -74
  199. data/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
  200. data/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
  201. data/node_modules/readable-stream/package.json +0 -52
  202. data/node_modules/readable-stream/passthrough.js +0 -1
  203. data/node_modules/readable-stream/readable-browser.js +0 -7
  204. data/node_modules/readable-stream/readable.js +0 -19
  205. data/node_modules/readable-stream/transform.js +0 -1
  206. data/node_modules/readable-stream/writable-browser.js +0 -1
  207. data/node_modules/readable-stream/writable.js +0 -8
  208. data/node_modules/rimraf/LICENSE +0 -15
  209. data/node_modules/rimraf/README.md +0 -101
  210. data/node_modules/rimraf/bin.js +0 -50
  211. data/node_modules/rimraf/package.json +0 -29
  212. data/node_modules/rimraf/rimraf.js +0 -372
  213. data/node_modules/safe-buffer/LICENSE +0 -21
  214. data/node_modules/safe-buffer/README.md +0 -584
  215. data/node_modules/safe-buffer/index.d.ts +0 -187
  216. data/node_modules/safe-buffer/index.js +0 -62
  217. data/node_modules/safe-buffer/package.json +0 -37
  218. data/node_modules/selenium-webdriver/CHANGES.md +0 -1114
  219. data/node_modules/selenium-webdriver/LICENSE +0 -202
  220. data/node_modules/selenium-webdriver/NOTICE +0 -2
  221. data/node_modules/selenium-webdriver/README.md +0 -229
  222. data/node_modules/selenium-webdriver/chrome.js +0 -295
  223. data/node_modules/selenium-webdriver/chromium.js +0 -829
  224. data/node_modules/selenium-webdriver/devtools/CDPConnection.js +0 -35
  225. data/node_modules/selenium-webdriver/edge.js +0 -224
  226. data/node_modules/selenium-webdriver/example/chrome_android.js +0 -45
  227. data/node_modules/selenium-webdriver/example/chrome_mobile_emulation.js +0 -46
  228. data/node_modules/selenium-webdriver/example/firefox_channels.js +0 -84
  229. data/node_modules/selenium-webdriver/example/google_search.js +0 -50
  230. data/node_modules/selenium-webdriver/example/google_search_test.js +0 -70
  231. data/node_modules/selenium-webdriver/example/headless.js +0 -63
  232. data/node_modules/selenium-webdriver/example/logging.js +0 -64
  233. data/node_modules/selenium-webdriver/firefox.js +0 -789
  234. data/node_modules/selenium-webdriver/http/index.js +0 -324
  235. data/node_modules/selenium-webdriver/http/util.js +0 -172
  236. data/node_modules/selenium-webdriver/ie.js +0 -503
  237. data/node_modules/selenium-webdriver/index.js +0 -825
  238. data/node_modules/selenium-webdriver/io/exec.js +0 -162
  239. data/node_modules/selenium-webdriver/io/index.js +0 -348
  240. data/node_modules/selenium-webdriver/io/zip.js +0 -223
  241. data/node_modules/selenium-webdriver/lib/atoms/find-elements.js +0 -123
  242. data/node_modules/selenium-webdriver/lib/atoms/get-attribute.js +0 -101
  243. data/node_modules/selenium-webdriver/lib/atoms/is-displayed.js +0 -101
  244. data/node_modules/selenium-webdriver/lib/atoms/mutation-listener.js +0 -55
  245. data/node_modules/selenium-webdriver/lib/by.js +0 -415
  246. data/node_modules/selenium-webdriver/lib/capabilities.js +0 -553
  247. data/node_modules/selenium-webdriver/lib/command.js +0 -206
  248. data/node_modules/selenium-webdriver/lib/error.js +0 -605
  249. data/node_modules/selenium-webdriver/lib/http.js +0 -704
  250. data/node_modules/selenium-webdriver/lib/input.js +0 -946
  251. data/node_modules/selenium-webdriver/lib/logging.js +0 -661
  252. data/node_modules/selenium-webdriver/lib/promise.js +0 -285
  253. data/node_modules/selenium-webdriver/lib/proxy.js +0 -212
  254. data/node_modules/selenium-webdriver/lib/session.js +0 -77
  255. data/node_modules/selenium-webdriver/lib/symbols.js +0 -37
  256. data/node_modules/selenium-webdriver/lib/until.js +0 -429
  257. data/node_modules/selenium-webdriver/lib/webdriver.js +0 -2919
  258. data/node_modules/selenium-webdriver/net/index.js +0 -107
  259. data/node_modules/selenium-webdriver/net/portprober.js +0 -75
  260. data/node_modules/selenium-webdriver/opera.js +0 -406
  261. data/node_modules/selenium-webdriver/package.json +0 -54
  262. data/node_modules/selenium-webdriver/proxy.js +0 -32
  263. data/node_modules/selenium-webdriver/remote/index.js +0 -624
  264. data/node_modules/selenium-webdriver/safari.js +0 -168
  265. data/node_modules/selenium-webdriver/testing/index.js +0 -504
  266. data/node_modules/set-immediate-shim/index.js +0 -7
  267. data/node_modules/set-immediate-shim/package.json +0 -34
  268. data/node_modules/set-immediate-shim/readme.md +0 -31
  269. data/node_modules/string_decoder/.travis.yml +0 -50
  270. data/node_modules/string_decoder/LICENSE +0 -48
  271. data/node_modules/string_decoder/README.md +0 -47
  272. data/node_modules/string_decoder/lib/string_decoder.js +0 -296
  273. data/node_modules/string_decoder/package.json +0 -31
  274. data/node_modules/tmp/CHANGELOG.md +0 -288
  275. data/node_modules/tmp/LICENSE +0 -21
  276. data/node_modules/tmp/README.md +0 -365
  277. data/node_modules/tmp/lib/tmp.js +0 -780
  278. data/node_modules/tmp/node_modules/.bin/rimraf +0 -1
  279. data/node_modules/tmp/node_modules/rimraf/CHANGELOG.md +0 -65
  280. data/node_modules/tmp/node_modules/rimraf/LICENSE +0 -15
  281. data/node_modules/tmp/node_modules/rimraf/README.md +0 -101
  282. data/node_modules/tmp/node_modules/rimraf/bin.js +0 -68
  283. data/node_modules/tmp/node_modules/rimraf/package.json +0 -32
  284. data/node_modules/tmp/node_modules/rimraf/rimraf.js +0 -360
  285. data/node_modules/tmp/package.json +0 -58
  286. data/node_modules/util-deprecate/History.md +0 -16
  287. data/node_modules/util-deprecate/LICENSE +0 -24
  288. data/node_modules/util-deprecate/README.md +0 -53
  289. data/node_modules/util-deprecate/browser.js +0 -67
  290. data/node_modules/util-deprecate/node.js +0 -6
  291. data/node_modules/util-deprecate/package.json +0 -27
  292. data/node_modules/wrappy/LICENSE +0 -15
  293. data/node_modules/wrappy/README.md +0 -36
  294. data/node_modules/wrappy/package.json +0 -29
  295. data/node_modules/wrappy/wrappy.js +0 -33
  296. data/node_modules/ws/LICENSE +0 -21
  297. data/node_modules/ws/README.md +0 -496
  298. data/node_modules/ws/browser.js +0 -8
  299. data/node_modules/ws/index.js +0 -10
  300. data/node_modules/ws/lib/buffer-util.js +0 -129
  301. data/node_modules/ws/lib/constants.js +0 -10
  302. data/node_modules/ws/lib/event-target.js +0 -184
  303. data/node_modules/ws/lib/extension.js +0 -223
  304. data/node_modules/ws/lib/limiter.js +0 -55
  305. data/node_modules/ws/lib/permessage-deflate.js +0 -517
  306. data/node_modules/ws/lib/receiver.js +0 -507
  307. data/node_modules/ws/lib/sender.js +0 -405
  308. data/node_modules/ws/lib/stream.js +0 -165
  309. data/node_modules/ws/lib/validation.js +0 -104
  310. data/node_modules/ws/lib/websocket-server.js +0 -418
  311. data/node_modules/ws/lib/websocket.js +0 -942
  312. data/node_modules/ws/package.json +0 -56
  313. data/package-lock.json +0 -458
  314. data/package.json +0 -5
  315. data/selenium.log +0 -1
  316. data/spec.md +0 -6
  317. 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