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

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

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器