我使用facebook php-webdriver并下载IE驱动程序来运行IE,我设法运行IE但是网址没有提交。所有其他浏览器工作正常,Chrome和Firefox只有IE是我现在唯一的问题。这是错误代码:
Fatal error: Uncaught exception 'WebDriverCurlException' with message 'Curl error thrown for http POST to http://localhost:5555/session with params: {"desiredCapabilities":{"browserName":"internet explorer","platform":"WINDOWS"}} Recv failure: Connection was reset' in C:\xampp\htdocs\facebook\lib\WebDriverExceptions.php:39 Stack trace: #0 C:\xampp\htdocs\facebook\lib\remote\HttpCommandExecutor.php(256): WebDriverException::throwException(-1, 'Curl error thro...', Array) #1 C:\xampp\htdocs\facebook\lib\remote\HttpCommandExecutor.php(177): HttpCommandExecutor::curl('POST', 'http://localhos...', Array, Array) #2 C:\xampp\htdocs\facebook\lib\remote\RemoteWebDriver.php(117): HttpCommandExecutor::remoteExecute(Array, Array) #3 C:\xampp\htdocs\facebook\lib\remote\RemoteWebDriver.php(63): RemoteWebDriver::remoteExecuteHttpCommand(5000, Array) #4 C:\xampp\htdocs\facebook\example.php(7): RemoteWebDriver::create('http://localhos...', Object(DesiredCapabilities), 5000) #5 {main} thrown in C:\xampp\htdocs\facebook\lib\WebDriverExceptions.php on line 39
这是我的编码。
<?php
require_once('lib/__init__.php');
$host = 'http://localhost:5555/';
$driver = RemoteWebDriver::create($host, DesiredCapabilities::internetExplorer(), 5000);
$driver->get('http://google.com/');
$driver->wait(5);
$driver->quit();
?>
答案 0 :(得分:0)
顺便说一下,对我来说,以下初始化工作正常,但我正在研究phantomJs:
public function __construct($selenium_node_ip)
{
$host = 'http://'.$selenium_node_ip.':8080';
$this->driver = RemoteWebDriver::create($host,DesiredCapabilities::phantomjs(),5000);
}
=====
嘿,我正在使用folloinwg堆栈: 硒中枢+ selenim节点。 我正在连接到集线器并在单独的noed上执行测试。 当phantomJs'过载'时,它会引发以下异常:Fatal error: Uncaught exception 'WebDriverCurlException' with message ' in /var/www/releases/5/application/lib/FB-WebDriver/lib/WebDriverExceptions.php on line 39 WebDriverCurlException: Curl error thrown for http POST to http://162.243.171.193:8080/session with params: {"desiredCapabilities":{"browserName":"phantomjs","platform":"ANY"}} couldn't connect to host in /var/www/releases/5/application/lib/FB-WebDriver/lib/WebDriverExceptions.php on line 39 Call Stack: 0.0003 638008 1. {main}() /var/www/releases/5/public_html/api/index.php:0 0.0006 664328 2. include('/var/www/releases/5/application/script/api/index.php') /var/www/releases/5/public_html/api/index.php:1 0.0491 6994280 3. FacabookCrawler->__construct() /var/www/releases/5/application/script/api/index.php:20 0.0491 6995920 4. RemoteWebDriver::create() /var/www/releases/5/application/lib/facebookCrawler.class.php:9 0.0492 6997296 5. HttpCommandExecutor->execute() /var/www/releases/5/application/lib/FB-WebDriver/lib/remote/RemoteWebDriver.php:78 0.0492 6997664 6. HttpCommandExecutor::curl() /var/www/releases/5/application/lib/FB-WebDriver/lib/remote/HttpCommandExecutor.php:130 0.0500 7000832 7. WebDriverException::throwException() /var/www/releases/5/application/lib/FB-WebDriver/lib/remote/HttpCommandExecutor.php:208
http://gyazo.com/ac32123059b95483dd53ec9e373f460b
至于现在,我仍然没有找到解决它的好方案,但是 在节点上我使用
重新启动幻像jssudo service phantomjs restart
http://gyazo.com/ae48dcf945010c28cf41d31c43a08c40
然后对我来说还可以: http://gyazo.com/646bf26a48d367bb9e793a847a49de5c
希望以某种方式帮助您找出问题的根本原因