selenium-webdriver 4.0.0-beta.1 → 4.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/webdriver.js CHANGED
@@ -35,6 +35,7 @@ const WebSocket = require('ws')
35
35
  const http = require('../http/index')
36
36
  const fs = require('fs')
37
37
  const { Capabilities } = require('./capabilities')
38
+ const path = require('path')
38
39
 
39
40
  // Capability names that are defined in the W3C spec.
40
41
  const W3C_CAPABILITY_NAMES = new Set([
@@ -648,6 +649,7 @@ function filterNonW3CCaps(capabilities) {
648
649
  * @implements {IWebDriver}
649
650
  */
650
651
  class WebDriver {
652
+
651
653
  /**
652
654
  * @param {!(./session.Session|IThenable<!./session.Session>)} session Either
653
655
  * a known session or a promise that will be resolved to a session.
@@ -1159,12 +1161,13 @@ class WebDriver {
1159
1161
  */
1160
1162
  async createCDPConnection(target) {
1161
1163
  const caps = await this.getCapabilities()
1162
- const seOptions = caps['map_'].get('se:options') || new Map()
1164
+ const seCdp = caps['map_'].get('se:cdp')
1163
1165
  const vendorInfo =
1164
1166
  caps['map_'].get(this.VENDOR_COMMAND_PREFIX + ':chromeOptions') ||
1167
+ caps['map_'].get(this.VENDOR_CAPABILITY_PREFIX + ':edgeOptions') ||
1165
1168
  caps['map_'].get('moz:debuggerAddress') ||
1166
- new Map()
1167
- const debuggerUrl = seOptions['cdp'] || vendorInfo['debuggerAddress'] || vendorInfo
1169
+ new Map();
1170
+ const debuggerUrl = seCdp || vendorInfo['debuggerAddress'] || vendorInfo
1168
1171
  this._wsUrl = await this.getWsUrl(debuggerUrl, target)
1169
1172
 
1170
1173
  return new Promise((resolve, reject) => {
@@ -1196,12 +1199,21 @@ class WebDriver {
1196
1199
  if (target && cdpTargets.indexOf(target.toLowerCase()) === -1) {
1197
1200
  throw new error.InvalidArgumentError('invalid target value')
1198
1201
  }
1199
- let path = '/json/version'
1200
-
1202
+ let path
1203
+ if (target === 'page') {
1204
+ path = '/json'
1205
+ } else {
1206
+ path = '/json/version'
1207
+ }
1201
1208
  let request = new http.Request('GET', path)
1202
1209
  let client = new http.HttpClient('http://' + debuggerAddress)
1203
1210
  let response = await client.send(request)
1204
- let url = JSON.parse(response.body)['webSocketDebuggerUrl']
1211
+ let url
1212
+ if (target.toLowerCase() === 'page') {
1213
+ url = JSON.parse(response.body)[0]['webSocketDebuggerUrl']
1214
+ } else {
1215
+ url = JSON.parse(response.body)['webSocketDebuggerUrl']
1216
+ }
1205
1217
 
1206
1218
  return url
1207
1219
  }
@@ -1362,7 +1374,7 @@ class WebDriver {
1362
1374
  .toString()
1363
1375
  } catch {
1364
1376
  mutationListener = fs
1365
- .readFileSync('./atoms/mutation-listener.js', 'utf-8')
1377
+ .readFileSync(path.resolve(__dirname, './atoms/mutation-listener.js'), 'utf-8')
1366
1378
  .toString()
1367
1379
  }
1368
1380
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "selenium-webdriver",
3
- "version": "4.0.0-beta.1",
3
+ "version": "4.0.0-beta.2",
4
4
  "description": "The official WebDriver JavaScript bindings from the Selenium project",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [
package/testing/index.js CHANGED
@@ -100,7 +100,7 @@ function getBrowsersToTestFromEnv() {
100
100
  const parts = spec.split(/:/, 3)
101
101
  let name = parts[0]
102
102
  if (name === 'ie') {
103
- name = Browser.IE
103
+ name = Browser.INTERNET_EXPLORER
104
104
  } else if (name === 'edge') {
105
105
  name = Browser.EDGE
106
106
  }
@@ -120,13 +120,8 @@ function getAvailableBrowsers() {
120
120
  let targets = [
121
121
  [chrome.locateSynchronously, Browser.CHROME],
122
122
  [edge.locateSynchronously, Browser.EDGE],
123
- [
124
- () => edge.locateSynchronously('msedge'),
125
- Browser.EDGE,
126
- { 'ms:edgeChromium': true },
127
- ],
128
123
  [firefox.locateSynchronously, Browser.FIREFOX],
129
- [ie.locateSynchronously, Browser.IE],
124
+ [ie.locateSynchronously, Browser.INTERNET_EXPLORER],
130
125
  [safari.locateSynchronously, Browser.SAFARI],
131
126
  [opera.locateSynchronously, Browser.OPERA],
132
127
  ]