down00111 2017-01-06 09:47
浏览 84
已采纳

Selenium与PHP firefox浏览器问题

I have a selenium-server-standalone-2.42.2.jar running on my ubuntu system with firefox 35 version. I am using phpwebdriver.As I run my Selenium script it open up the firefox browser and ends there. My script is:

<?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();

?>

When I run this script it opens the firefox and stops there and at last it throws me this error. I don't know how to resolve it.

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

What I am missing like? Or Maybe browser compatibilty issues?

  • 写回答

1条回答 默认 最新

  • douqi1931 2017-01-06 12:55
    关注

    i had the same problem while running tests on Firefox. browser has opened but unable to locate the URL in browser and given error. tried many ways but no help. finally i added all the jar files to library as how we do in eclipse using build path > libraries.

    it is working fine and I'm able to run my tests. using Firefox 35. Also upgrade your selenimum jar file version to (2.45).

    Hope it helps!!!

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

    报告相同问题?

    悬赏问题

    • ¥40 找同学帮敲Python代码
    • ¥15 MYSQL 订单的商品明细重复计算问题
    • ¥15 微信实时共享位置修改
    • ¥100 TG的session协议号转成直登号号后客户端登录几分钟后自动退出设备
    • ¥30 共模反馈回路的小信号增益
    • ¥15 arduino ssd1306函数与tone函数放歌代码不兼容问题
    • ¥70 0.96版本hbase的row_key里含有双引号,无法deleteall
    • ¥40 Ida Pro增加插件出现问题
    • ¥15 诊断性META分析合并效能的检验
    • ¥15 请问abb根据色块判断奇偶数并根据批次号放入仓储