我正在使用Selenium来测试一个具有HTTP Auth的网站,现在甚至是SSL证书.
作为HTTP Basic Authentification的解决方法,我正在使用ChromeDriver - http://code.google.com/p/selenium/wiki/ChromeDriver并以格式打开网址
https://username:password@my-test-site.com
Run Code Online (Sandbox Code Playgroud)
但是现在出于安全原因,需要在PC上安装客户端证书才能登录该应用程序.
但是,ChromeDriver无法看到"选择证书"提示,我甚至无法将其切换为警报.
有人解决了这个问题吗?
我正在使用 PHPUnit 运行所有测试。创建了一个包装器,用于启动 Apache 实例,然后启动 Selenium 独立服务器,然后在http://localhost:4444/wd/hub创建 Chrome Remote Webdriver 实例。这个过程在我们的开发机器上 100% 的时间有效,在测试服务器上 90% 的时间有效,但有时测试会失败,如下所示:
[exec] 1) Intranet\Pages\FinancialReportsSeleniumTest::test_changeMonthYear
[exec] Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY","chromeOptions":{"binary":"","args":["--window-size=1400,900","--no-sandbox","--headless"]},"goog:chromeOptions":{"args":["--window-size=1400,900","--no-sandbox","--headless"]}}}
[exec]
[exec] Failed to connect to localhost port 4444: Connection refused
[exec]
[exec] C:\Jenkins\jobs\Intranet-Master\workspace\vendor\facebook\webdriver\lib\Remote\HttpCommandExecutor.php:292
[exec] C:\Jenkins\jobs\Intranet-Master\workspace\vendor\facebook\webdriver\lib\Remote\RemoteWebDriver.php:126
[exec] C:\Jenkins\jobs\Intranet-Master\workspace\phpunit\library\Intranet\Selenium.php:364
[exec] C:\Jenkins\jobs\Intranet-Master\workspace\phpunit\library\Intranet\Selenium.php:51
[exec] C:\Jenkins\jobs\Intranet-Master\workspace\phpunit\library\Intranet\SeleniumTestCase.php:9
Run Code Online (Sandbox Code Playgroud)
如果我们重新运行测试,下次就可以正常工作。
开发机器:
试验机
windows selenium phpunit google-chrome selenium-chromedriver