简体   繁体   中英

Selenium with PHP firefox browser issues

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM