claudio-vieira / php-webdriver-bindings

Automatically exported from code.google.com/p/php-webdriver-bindings
0 stars 0 forks source link

Unable to run this library. #40

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I download the library today and try to run it but instead of the successful 
running I got the following errors

The result I got for example.php in the library.

Notice: Undefined offset: 1 in 
C:\xampp\htdocs\PHPSELENIUM\phpwebdriver\WebDriver.php on line 58

Notice: Trying to get property of non-object in 
C:\xampp\htdocs\PHPSELENIUM\phpwebdriver\WebDriver.php on line 60

here is my example code

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

Original issue reported on code.google.com by 110165...@umt.edu.pk on 13 Jan 2015 at 4:28

GoogleCodeExporter commented 9 years ago
I changed my xampp server port to 8080 instead of 80. So when I change above 
code to the following code

<?php
require_once "phpwebdriver/WebDriver.php";

$webdriver = new WebDriver("localhost", "8080");
$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();
?>

then I face the following error.

Notice: Trying to get property of non-object in 
C:\xampp\htdocs\PHPSELENIUM\phpwebdriver\WebDriver.php on line 60

Original comment by 110165...@umt.edu.pk on 13 Jan 2015 at 4:36

GoogleCodeExporter commented 9 years ago
Sounds like you are confusing how to connect the PHP webdriver? You don't need 
to use XAMPP or any web server for this library. Just PHP binary whether it's 
standalone or installed with XAMP or other web server package.

You do however need to start up the Selenium Server JAR (i.e. for 
RemoteWebDriver, or start it up for Selenium Grid mode of a hub and a node). 
Then you connect to the Selenium Server that was started. By default it is port 
4444 and you run it on the same localhost. However you can run it on a remote 
machine or use a different port with Selenium Server startup command line (or 
config file) options.

Original comment by manga...@gmail.com on 27 Apr 2015 at 3:37