我在我的ubuntu系统上使用firefox 35版本运行了selenium-server-standalone-2.42.2.jar。我正在使用phpwebdriver.As我运行我的Selenium脚本它打开firefox浏览器并结束那里。 我的剧本是:
<?php
require_once "phpwebdriver/WebDriver.php";
$webdriver = new WebDriver("localhost", "4444");
$webdriver->connect("firefox");
$webdriver->get("http://google.com");
$element = $webdriver->findElementBy(LocatorStrategy::name, "q");
if ($element) {
$element->sendKeys(array("php webdriver" ) );
$element->submit();
}
//$webdriver->close();
?>
当我运行这个脚本时,它会打开firefox并停在那里,最后它会抛出这个错误。我不知道如何解决它。
stdClass Object
(
[status] => 13
[sessionId] =>
[value] => stdClass Object
(
[message] => POST /session//element
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
System info: host: 'zaptech', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.2.0-27-generic', java.version: '1.7.0_121'
Driver info: driver.version: unknown
[localizedMessage] => POST /session//element
Build info: version: '2.42.2', revision: '6a6995d', time: '2014-06-03 17:42:03'
System info: host: 'zaptech', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.2.0-27-generic', java.version: '1.7.0_121'
Driver info: driver.version: unknown
[suppressed] => Array
(
)
[cause] =>
[supportUrl] =>
[systemInformation] => System info: host: 'zaptech', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.2.0-27-generic', java.version: '1.7.0_121'
[class] => org.openqa.selenium.UnsupportedCommandException
[additionalInformation] =>
Driver info: driver.version: unknown
[hCode] => 1436132011
[stackTrace] => Array
(
[0] =>
[1] =>
[2] =>
[3] =>
[4] =>
[5] =>
[6] =>
[7] =>
[8] =>
[9] =>
[10] =>
[11] =>
[12] =>
[13] =>
[14] =>
[15] =>
[16] =>
[17] =>
[18] =>
)
)
[state] => unhandled error
[class] => org.openqa.selenium.remote.Response
[hCode] => 1502000244
)
PHP Fatal error: Uncaught exception 'WebDriverException' with message '13' in /var/www/html/selenium/wdtest/phpwebdriver/WebDriverBase.php:130
Stack trace:
#0 /var/www/html/selenium/wdtest/phpwebdriver/WebDriverBase.php(170): WebDriverBase->handleResponse(Object(stdClass))
#1 /var/www/html/selenium/wdtest/index.php(24): WebDriverBase->findElementBy('name', 'q')
#2 {main}
thrown in /var/www/html/selenium/wdtest/phpwebdriver/WebDriverBase.php on line 130
我缺少的是什么?或者浏览器兼容性问题?
答案 0 :(得分:-1)
我在Firefox上运行测试时遇到了同样的问题。浏览器已打开但无法使用
在浏览器中找到URL并给出错误。尝试了许多方法但没有帮助。最后
我使用build path > libraries.
它工作正常,我可以运行我的测试。使用Firefox 35.
同时将您的selenimum jar文件版本升级到(2.45)
。
希望它有所帮助!!!