122
122
* @module selenium-webdriver/chrome
123
123
*/
124
124
125
- " use strict" ;
125
+ ' use strict'
126
126
127
- const { Browser } = require ( " ./lib/capabilities" ) ;
128
- const chromium = require ( " ./chromium" ) ;
129
- const CHROME_CAPABILITY_KEY = " goog:chromeOptions" ;
127
+ const { Browser } = require ( ' ./lib/capabilities' )
128
+ const chromium = require ( ' ./chromium' )
129
+ const CHROME_CAPABILITY_KEY = ' goog:chromeOptions'
130
130
131
131
/** @type {remote.DriverService } */
132
132
@@ -136,105 +136,104 @@ const CHROME_CAPABILITY_KEY = "goog:chromeOptions";
136
136
* server in a child process.
137
137
*/
138
138
class ServiceBuilder extends chromium . ServiceBuilder {
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
- }
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
+ }
150
150
}
151
151
152
152
/**
153
153
* Class for managing ChromeDriver specific options.
154
154
*/
155
155
class Options extends chromium . Options {
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
- }
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
+ }
170
170
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
- }
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
+ }
180
180
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
- }
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
+ }
190
190
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
- }
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
+ }
200
200
}
201
201
202
202
/**
203
203
* Creates a new WebDriver client for Chrome.
204
204
*/
205
205
class Driver extends chromium . Driver {
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
- }
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 , opt_serviceExecutor , 'goog' , CHROME_CAPABILITY_KEY ) )
220
+ }
222
221
223
- /**
224
- * returns new instance chrome driver service
225
- * @returns {remote.DriverService }
226
- */
227
- static getDefaultService ( ) {
228
- return new ServiceBuilder ( ) . build ( ) ;
229
- }
222
+ /**
223
+ * returns new instance chrome driver service
224
+ * @returns {remote.DriverService }
225
+ */
226
+ static getDefaultService ( ) {
227
+ return new ServiceBuilder ( ) . build ( )
228
+ }
230
229
}
231
230
232
- Options . prototype . CAPABILITY_KEY = CHROME_CAPABILITY_KEY ;
233
- Options . prototype . BROWSER_NAME_VALUE = Browser . CHROME ;
231
+ Options . prototype . CAPABILITY_KEY = CHROME_CAPABILITY_KEY
232
+ Options . prototype . BROWSER_NAME_VALUE = Browser . CHROME
234
233
235
234
// PUBLIC API
236
235
module . exports = {
237
- Driver,
238
- Options,
239
- ServiceBuilder
240
- } ;
236
+ Driver,
237
+ Options,
238
+ ServiceBuilder,
239
+ }
0 commit comments