geckodriver icon indicating copy to clipboard operation
geckodriver copied to clipboard

Proxy with authentcation is not accepted

Open OndraM opened this issue 3 years ago • 1 comments

System

  • Version: 0.29.1
  • Platform: arch linux 64
  • Firefox: 87.0
  • Selenium: php-webdriver

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.

<?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/');

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:

$ 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.

OndraM avatar Apr 14 '21 11:04 OndraM

A proxy with authentication is not supported yet. The required work is tracked via https://bugzilla.mozilla.org/show_bug.cgi?id=1395886.

whimboo avatar Apr 14 '21 20:04 whimboo