First of all I have installed Selenium Server Standalone 3.9.1, XAMPP 3.2.2, php-webdriver 0.9.1 and Firefox 57 and I want to run the example.php file from the root of the selenium folder. This is the code:
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();
}
When I run this code on a chrome page, firefox is opened, google.com is opened and it stops, it doesn't do anything. It should search in google search bar for 'php webdriver' but it doesn't. I get the next notice on chrome page where I run this code:
Notice: Undefined property: stdClass::$ELEMENT in ...\WebDriver\phpwebdriver\WebElement.php on line 28
I've tried to:
- run the code with and without firefox version
- run the code with another browser (chrome) but there I get another error (Undefined property: stdClass::$sessionId)
- installed selenium server standalone 3.4.0
Nothing works! Can anyone help me with this problem?
Aucun commentaire:
Enregistrer un commentaire