selenium.remote.Response [status] => 13在Selenium PHPwebdriver中

时间:2015-04-20 10:29:46

标签: php selenium

我是硒测试的新手。我从Selenium Hq下载了名为PHP by Chibimagic的selenium php绑定。我的问题是在运行网站提供的简单示例代码时,我的php_error_log文件中出现错误

[20-Apr-2015 15:41:37 Asia/Calcutta] PHP Fatal error:  Uncaught exception 'WebDriverException' with message '13' in C:\xampp\htdocs\my-work\sele\phpwebdriver\WebDriverBase.php:130
Stack trace:<br>
 C:\xampp\htdocs\my-work\sele\phpwebdriver\WebDriverBase.php(170): WebDriverBase->handleResponse(Object(stdClass))<br>
C:\xampp\htdocs\my-work\sele\example.php(24): WebDriverBase->findElementBy('name', 'q')
{main}
 thrown in C:\xampp\htdocs\my-work\sele\phpwebdriver\WebDriverBase.php on line 130

我的代码是

require_once "phpwebdriver/WebDriver.php";
$webdriver = new WebDriver("localhost", "4444");
$webdriver->connect("firefox");                            
$webdriver->get("http://www.google.co.in");
$element = $webdriver->findElementBy(LocatorStrategy::name, "q");
if ($element) {
$element->sendKeys(array("php webdriver" ) );
$element->submit();
}
$webdriver->close();

并且网页上的显示为

stdClass Object ( [state] => unhandled error [sessionId] => [hCode] =>          32124297 [value] => stdClass Object ( [additionalInformation] => Driver info: driver.version: unknown [localizedMessage] => POST /session//element Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50' System info: host: 'admin', ip: '192.168.1.16', os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.8.0_40' Driver info: driver.version: unknown [supportUrl] => [systemInformation] => System info: host: 'admin', ip: '192.168.1.16', os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.8.0_40' [cause] => [stackTrace] => Array ( [0] => [1] => [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => [10] => [11] => [12] => [13] => [14] => [15] => [16] => [17] => [18] => ) [suppressed] => Array ( ) [message] => POST /session//element Build info: version: '2.45.0', revision: '5017cb8', time: '2015-02-26 23:59:50' System info: host: 'admin', ip: '192.168.1.16', os.name: 'Windows XP', os.arch: 'x86', os.version: '5.1', java.version: '1.8.0_40' Driver info: driver.version: unknown [hCode] => 20849676 [class] => org.openqa.selenium.UnsupportedCommandException [buildInformation] => ) [class] => org.openqa.selenium.remote.Response [status] => 13 )

1 个答案:

答案 0 :(得分:0)

由于版本不匹配,错误即将发生。 将firefox版本降级到29.0,使其与selenium-server-standalone-2.42.2兼容。

这适合我。