Skip to content

Commit 34d2924

Browse files
authored
feat: new option webdriver_proxy to tunnel requests to the remote Server (#75)
1 parent fdf7051 commit 34d2924

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

src/Codeception/Module/WebDriver.php

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@
263263
* * `ssl_proxy_port` - sets ssl(https) proxy server port
264264
* * `debug_log_entries` - how many selenium entries to print with `debugWebDriverLogs` or on fail (0 by default).
265265
* * `log_js_errors` - Set to true to include possible JavaScript to HTML report, or set to false (default) to deactivate.
266+
* * `webdriver_proxy` - sets http proxy to tunnel requests to the remote Selenium WebDriver through
267+
* * `webdriver_proxy_port` - sets http proxy server port to tunnel requests to the remote Selenium WebDriver through
266268
*
267269
* Example (`acceptance.suite.yml`)
268270
*
@@ -376,25 +378,27 @@ class WebDriver extends CodeceptionModule implements
376378
{
377379
protected $requiredFields = ['browser', 'url'];
378380
protected $config = [
379-
'protocol' => 'http',
380-
'host' => '127.0.0.1',
381-
'port' => '4444',
382-
'path' => '/wd/hub',
383-
'start' => true,
384-
'restart' => false,
385-
'wait' => 0,
386-
'clear_cookies' => true,
387-
'window_size' => false,
388-
'capabilities' => [],
389-
'connection_timeout' => null,
390-
'request_timeout' => null,
391-
'pageload_timeout' => null,
392-
'http_proxy' => null,
393-
'http_proxy_port' => null,
394-
'ssl_proxy' => null,
395-
'ssl_proxy_port' => null,
396-
'debug_log_entries' => 0,
397-
'log_js_errors' => false
381+
'protocol' => 'http',
382+
'host' => '127.0.0.1',
383+
'port' => '4444',
384+
'path' => '/wd/hub',
385+
'start' => true,
386+
'restart' => false,
387+
'wait' => 0,
388+
'clear_cookies' => true,
389+
'window_size' => false,
390+
'capabilities' => [],
391+
'connection_timeout' => null,
392+
'request_timeout' => null,
393+
'pageload_timeout' => null,
394+
'http_proxy' => null,
395+
'http_proxy_port' => null,
396+
'ssl_proxy' => null,
397+
'ssl_proxy_port' => null,
398+
'debug_log_entries' => 0,
399+
'log_js_errors' => false,
400+
'webdriver_proxy' => null,
401+
'webdriver_proxy_port' => null,
398402
];
399403

400404
protected $wdHost;
@@ -404,10 +408,8 @@ class WebDriver extends CodeceptionModule implements
404408
protected $test;
405409
protected $sessions = [];
406410
protected $sessionSnapshots = [];
407-
protected $httpProxy;
408-
protected $httpProxyPort;
409-
protected $sslProxy;
410-
protected $sslProxyPort;
411+
protected $webdriverProxy;
412+
protected $webdriverProxyPort;
411413

412414
/**
413415
* @var RemoteWebDriver
@@ -446,6 +448,8 @@ public function _initialize()
446448
}
447449
$this->connectionTimeoutInMs = $this->config['connection_timeout'] * 1000;
448450
$this->requestTimeoutInMs = $this->config['request_timeout'] * 1000;
451+
$this->webdriverProxy = $this->config['webdriver_proxy'];
452+
$this->webdriverProxyPort = $this->config['webdriver_proxy_port'];
449453
$this->loadFirefoxProfile();
450454
}
451455

@@ -1596,8 +1600,8 @@ public function _initializeSession()
15961600
$this->capabilities,
15971601
$this->connectionTimeoutInMs,
15981602
$this->requestTimeoutInMs,
1599-
$this->httpProxy,
1600-
$this->httpProxyPort
1603+
$this->webdriverProxy,
1604+
$this->webdriverProxyPort
16011605
);
16021606
if (!is_null($this->config['pageload_timeout'])) {
16031607
$this->webDriver->manage()->timeouts()->pageLoadTimeout($this->config['pageload_timeout']);

0 commit comments

Comments
 (0)