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!!!

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

报告相同问题?

悬赏问题

  • ¥30 eclipse开启服务后,网页无法打开
  • ¥30 雷达辐射源信号参考模型
  • ¥15 html+css+js如何实现这样子的效果?
  • ¥15 STM32单片机自主设计
  • ¥15 如何在node.js中或者java中给wav格式的音频编码成sil格式呢
  • ¥15 不小心不正规的开发公司导致不给我们y码,
  • ¥15 我的代码无法在vc++中运行呀,错误很多
  • ¥50 求一个win系统下运行的可自动抓取arm64架构deb安装包和其依赖包的软件。
  • ¥60 fail to initialize keyboard hotkeys through kernel.0000000000
  • ¥30 ppOCRLabel导出识别结果失败