File tree Expand file tree Collapse file tree 4 files changed +35
-6
lines changed
javascript/node/selenium-webdriver Expand file tree Collapse file tree 4 files changed +35
-6
lines changed Original file line number Diff line number Diff line change
1
+ ## v2.54.0-dev
2
+
3
+ * Allow users to set the agent used for HTTP connections through
4
+ ` builder.Builder#usingHttpAgent() `
5
+
1
6
## v2.53.2
2
7
3
8
* Changed ` io.exists() ` to return a rejected promise if the input path is not
Original file line number Diff line number Diff line change @@ -128,6 +128,9 @@ class Builder {
128
128
129
129
/** @private {boolean} */
130
130
this . ignoreEnv_ = false ;
131
+
132
+ /** @private {http.Agent} */
133
+ this . agent_ = null ;
131
134
}
132
135
133
136
/**
@@ -187,6 +190,25 @@ class Builder {
187
190
return this . proxy_ ;
188
191
}
189
192
193
+ /**
194
+ * Sets the http agent to use for each request.
195
+ * If this method is not called, the Builder will use http.globalAgent by default.
196
+ *
197
+ * @param {http.Agent } agent The agent to use for each request.
198
+ * @return {!Builder } A self reference.
199
+ */
200
+ usingHttpAgent ( agent ) {
201
+ this . agent_ = agent ;
202
+ return this ;
203
+ }
204
+
205
+ /**
206
+ * @return {http.Agent } The http agent used for each request
207
+ */
208
+ getHttpAgent ( ) {
209
+ return this . agent_ ;
210
+ }
211
+
190
212
/**
191
213
* Sets the desired capabilities when requesting a new session. This will
192
214
* overwrite any previously set capabilities.
@@ -454,7 +476,7 @@ class Builder {
454
476
}
455
477
456
478
if ( url ) {
457
- var executor = executors . createExecutor ( url , this . proxy_ ) ;
479
+ var executor = executors . createExecutor ( url , this . agent_ , this . proxy_ ) ;
458
480
return WebDriver . createSession ( executor , capabilities , this . flow_ ) ;
459
481
}
460
482
Original file line number Diff line number Diff line change @@ -38,13 +38,15 @@ exports.DeferredExecutor = DeferredExecutor;
38
38
* Creates a command executor that uses WebDriver's JSON wire protocol.
39
39
* @param {(string|!promise.Promise<string>) } url The server's URL,
40
40
* or a promise that will resolve to that URL.
41
- * @param {?string= } opt_proxy (optional) The URL of the HTTP proxy for the
42
- * client to use.
41
+ * @param {http.Agent= } opt_agent (optional) The Http.Agent for the client to
42
+ * use.
43
+ * @param {(string|null)= } opt_proxy (optional) The URL of the HTTP proxy for
44
+ * the client to use.
43
45
* @returns {!./lib/command.Executor } The new command executor.
44
46
*/
45
- exports . createExecutor = function ( url , opt_proxy ) {
47
+ exports . createExecutor = function ( url , opt_agent , opt_proxy ) {
46
48
return new DeferredExecutor ( promise . when ( url , function ( url ) {
47
- var client = new HttpClient ( url , null , opt_proxy ) ;
49
+ var client = new HttpClient ( url , opt_agent , opt_proxy ) ;
48
50
return new HttpExecutor ( client ) ;
49
51
} ) ) ;
50
52
} ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " selenium-webdriver" ,
3
- "version" : " 2.53.2 " ,
3
+ "version" : " 2.54.0-dev " ,
4
4
"description" : " The official WebDriver JavaScript bindings from the Selenium project" ,
5
5
"license" : " Apache-2.0" ,
6
6
"keywords" : [
You can’t perform that action at this time.
0 commit comments