I initialize session from php-webdriver, but I believe the issue does not depend on the language bindings used. So here they are just for reference and as an example.
<?php
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Facebook\WebDriver\Remote\WebDriverBrowserType;
use Facebook\WebDriver\Remote\WebDriverCapabilityType;
require_once('vendor/autoload.php');
$capabilities = new DesiredCapabilities(
[
'browserName' => 'firefox',
'proxy' => [
'proxyType' => 'manual',
'httpProxy' => 'user:pass@localhost:8080',
'sslProxy' => 'user:pass@localhost:8080',
]
]
);
$driver = RemoteWebDriver::create('http://localhost:4444', $capabilities);
$driver->get('https://google.com/');
Output of geckodriver --log debug when script above is executed:
$ geckodriver --log debug
1618399457852 geckodriver INFO Listening on 127.0.0.1:4444
1618399458972 webdriver::server DEBUG -> POST /session {"capabilities":{"firstMatch":[{"browserName":"firefox","proxy":{"proxyType":"manual","httpProxy":"user:pass@localhost:8080","sslProxy":"user:pass@localhost:8080"}}]}}
1618399458972 webdriver::server DEBUG <- 400 Bad Request {"value":{"error":"invalid argument","message":"httpProxy is not of the form host[:port]: user:pass@localhost:8080","stacktrace":""}}
From the error httpProxy is not of the form host[:port] it seems geckodriver does not accept the W3C WebDriver form according to the specification.
System
Testcase
I initialize session from php-webdriver, but I believe the issue does not depend on the language bindings used. So here they are just for reference and as an example.
According to W3C WebDriver specification, this form is a proper way how to pass proxy credentials.
Stacktrace
Output of
geckodriver --log debug
when script above is executed:From the error
httpProxy is not of the form host[:port]
it seems geckodriver does not accept the W3C WebDriver form according to the specification.