Skip to content

Commit 4e1fd04

Browse files
committed
[js] Marking those as modules
1 parent 9ff86f3 commit 4e1fd04

File tree

6 files changed

+1977
-1908
lines changed

6 files changed

+1977
-1908
lines changed

javascript/node/selenium-webdriver/chrome.js

Lines changed: 87 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,15 @@
118118
* [PATH]: http://en.wikipedia.org/wiki/PATH_%28variable%29
119119
* [android]: https://chromedriver.chromium.org/getting-started/getting-started---android
120120
* [webview]: https://developer.chrome.com/multidevice/webview/overview
121+
*
122+
* @module selenium-webdriver/chrome
121123
*/
122124

123-
'use strict'
125+
"use strict";
124126

125-
const { Browser } = require('./lib/capabilities')
126-
const chromium = require('./chromium')
127-
const CHROME_CAPABILITY_KEY = 'goog:chromeOptions'
127+
const { Browser } = require("./lib/capabilities");
128+
const chromium = require("./chromium");
129+
const CHROME_CAPABILITY_KEY = "goog:chromeOptions";
128130

129131
/** @type {remote.DriverService} */
130132

@@ -134,104 +136,105 @@ const CHROME_CAPABILITY_KEY = 'goog:chromeOptions'
134136
* server in a child process.
135137
*/
136138
class ServiceBuilder extends chromium.ServiceBuilder {
137-
/**
138-
* @param {string=} opt_exe Path to the server executable to use. If omitted,
139-
* the builder will attempt to locate the chromedriver on the current
140-
* PATH. If the chromedriver is not available in path, selenium-manager will
141-
* download the chromedriver
142-
* @throws {Error} If provided executable does not exist, or the chromedriver
143-
* cannot be found on the PATH.
144-
*/
145-
constructor(opt_exe) {
146-
super(opt_exe)
147-
}
139+
/**
140+
* @param {string=} opt_exe Path to the server executable to use. If omitted,
141+
* the builder will attempt to locate the chromedriver on the current
142+
* PATH. If the chromedriver is not available in path, selenium-manager will
143+
* download the chromedriver
144+
* @throws {Error} If provided executable does not exist, or the chromedriver
145+
* cannot be found on the PATH.
146+
*/
147+
constructor (opt_exe) {
148+
super(opt_exe);
149+
}
148150
}
149151

150152
/**
151153
* Class for managing ChromeDriver specific options.
152154
*/
153155
class Options extends chromium.Options {
154-
/**
155-
* Sets the path to the Chrome binary to use. On Mac OS X, this path should
156-
* reference the actual Chrome executable, not just the application binary
157-
* (e.g. "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome").
158-
*
159-
* The binary path be absolute or relative to the chromedriver server
160-
* executable, but it must exist on the machine that will launch Chrome.
161-
*
162-
* @param {string} path The path to the Chrome binary to use.
163-
* @return {!Options} A self reference.
164-
*/
165-
setChromeBinaryPath(path) {
166-
return this.setBinaryPath(path)
167-
}
156+
/**
157+
* Sets the path to the Chrome binary to use. On Mac OS X, this path should
158+
* reference the actual Chrome executable, not just the application binary
159+
* (e.g. "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome").
160+
*
161+
* The binary path be absolute or relative to the chromedriver server
162+
* executable, but it must exist on the machine that will launch Chrome.
163+
*
164+
* @param {string} path The path to the Chrome binary to use.
165+
* @return {!Options} A self reference.
166+
*/
167+
setChromeBinaryPath (path) {
168+
return this.setBinaryPath(path);
169+
}
168170

169-
/**
170-
* Configures the ChromeDriver to launch Chrome on Android via adb. This
171-
* function is shorthand for
172-
* {@link #androidPackage options.androidPackage('com.android.chrome')}.
173-
* @return {!Options} A self reference.
174-
*/
175-
androidChrome() {
176-
return this.androidPackage('com.android.chrome')
177-
}
171+
/**
172+
* Configures the ChromeDriver to launch Chrome on Android via adb. This
173+
* function is shorthand for
174+
* {@link #androidPackage options.androidPackage('com.android.chrome')}.
175+
* @return {!Options} A self reference.
176+
*/
177+
androidChrome () {
178+
return this.androidPackage("com.android.chrome");
179+
}
178180

179-
/**
180-
* Sets the path to Chrome's log file. This path should exist on the machine
181-
* that will launch Chrome.
182-
* @param {string} path Path to the log file to use.
183-
* @return {!Options} A self reference.
184-
*/
185-
setChromeLogFile(path) {
186-
return this.setBrowserLogFile(path)
187-
}
181+
/**
182+
* Sets the path to Chrome's log file. This path should exist on the machine
183+
* that will launch Chrome.
184+
* @param {string} path Path to the log file to use.
185+
* @return {!Options} A self reference.
186+
*/
187+
setChromeLogFile (path) {
188+
return this.setBrowserLogFile(path);
189+
}
188190

189-
/**
190-
* Sets the directory to store Chrome minidumps in. This option is only
191-
* supported when ChromeDriver is running on Linux.
192-
* @param {string} path The directory path.
193-
* @return {!Options} A self reference.
194-
*/
195-
setChromeMinidumpPath(path) {
196-
return this.setBrowserMinidumpPath(path)
197-
}
191+
/**
192+
* Sets the directory to store Chrome minidumps in. This option is only
193+
* supported when ChromeDriver is running on Linux.
194+
* @param {string} path The directory path.
195+
* @return {!Options} A self reference.
196+
*/
197+
setChromeMinidumpPath (path) {
198+
return this.setBrowserMinidumpPath(path);
199+
}
198200
}
199201

200202
/**
201203
* Creates a new WebDriver client for Chrome.
202204
*/
203205
class Driver extends chromium.Driver {
204-
/**
205-
* Creates a new session with the ChromeDriver.
206-
*
207-
* @param {(Capabilities|Options)=} opt_config The configuration options.
208-
* @param {(remote.DriverService|http.Executor)=} opt_serviceExecutor Either
209-
* a DriverService to use for the remote end, or a preconfigured executor
210-
* for an externally managed endpoint. If neither is provided, the
211-
* {@linkplain ##getDefaultService default service} will be used by
212-
* default.
213-
* @return {!Driver} A new driver instance.
214-
*/
215-
static createSession(opt_config, opt_serviceExecutor) {
216-
let caps = opt_config || new Options()
217-
return /** @type {!Driver} */ (super.createSession(caps, opt_serviceExecutor, 'goog', CHROME_CAPABILITY_KEY))
218-
}
206+
/**
207+
* Creates a new session with the ChromeDriver.
208+
*
209+
* @param {(Capabilities|Options)=} opt_config The configuration options.
210+
* @param {(remote.DriverService|http.Executor)=} opt_serviceExecutor Either
211+
* a DriverService to use for the remote end, or a preconfigured executor
212+
* for an externally managed endpoint. If neither is provided, the
213+
* {@linkplain ##getDefaultService default service} will be used by
214+
* default.
215+
* @return {!Driver} A new driver instance.
216+
*/
217+
static createSession (opt_config, opt_serviceExecutor) {
218+
let caps = opt_config || new Options();
219+
return /** @type {!Driver} */ (super.createSession(caps,
220+
opt_serviceExecutor, "goog", CHROME_CAPABILITY_KEY));
221+
}
219222

220-
/**
221-
* returns new instance chrome driver service
222-
* @returns {remote.DriverService}
223-
*/
224-
static getDefaultService() {
225-
return new ServiceBuilder().build()
226-
}
223+
/**
224+
* returns new instance chrome driver service
225+
* @returns {remote.DriverService}
226+
*/
227+
static getDefaultService () {
228+
return new ServiceBuilder().build();
229+
}
227230
}
228231

229-
Options.prototype.CAPABILITY_KEY = CHROME_CAPABILITY_KEY
230-
Options.prototype.BROWSER_NAME_VALUE = Browser.CHROME
232+
Options.prototype.CAPABILITY_KEY = CHROME_CAPABILITY_KEY;
233+
Options.prototype.BROWSER_NAME_VALUE = Browser.CHROME;
231234

232235
// PUBLIC API
233236
module.exports = {
234-
Driver,
235-
Options,
236-
ServiceBuilder,
237-
}
237+
Driver,
238+
Options,
239+
ServiceBuilder
240+
};

0 commit comments

Comments
 (0)