0
votes

I am trying to install selenium php binding in my Window 10 computer. I download selenium 3.13.0 and https://code.google.com/archive/p/php-webdriver-bindings/downloads version 0.9.1. I also download geckodriver-v0.21.0-win64.zip and run it ad administrator.

Since my gecko is running on port 4444, I start selenium server on port 4445

     java -jar selenium-server-standalone-3.13.0.jar -port 4445 

The example code I use is

require_once "phpwebdriver/WebDriver.php";
$webdriver = new WebDriver("localhost", "4445");
$webdriver->connect("firefox");                            
$webdriver->get("http://google.com");
$element = $webdriver->findElementBy(LocatorStrategy::name, "q");
if ($element) {
    $element->sendKeys(array("php webdriver" ) );
    $element->submit();
}

But I get the following error. I am using php 5.6.30. My Firefox is 61.0.1. My javs version is 1.8.0_171.

Could someone advise me how to fix the problem? Thanks.

Notice: Undefined property: stdClass::$sessionId in C:\AppServ\www\php-webdriver-bindings\phpwebdriver\WebDriver.php on line 60 stdClass Object ( [sessionId] => [value] => stdClass Object ( [error] => invalid session id [message] => No active session with ID [stacktrace] => ) [status] => 6 )

Fatal error: Uncaught exception 'WebDriverException' with message '6' in C:\AppServ\www\php-webdriver-bindings\phpwebdriver\WebDriverBase.php:130 Stack trace: #0 C:\AppServ\www\php-webdriver-bindings\phpwebdriver\WebDriverBase.php(170): WebDriverBase->handleResponse(Object(stdClass)) #1 C:\AppServ\www\php-webdriver-bindings\example2.php(25): WebDriverBase->findElementBy('name', 'q') #2 {main} thrown in C:\AppServ\www\php-webdriver-bindings\phpwebdriver\WebDriverBase.php on line 130

The selenium server output is :

D:\Selenium-server>java -jar selenium-server-standalone-3.13.0.jar -port 4445 19:12:35.888 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.13.0', revision: '2f0d292'

19:12:35.888 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 4445 2018-07-10 19:12:36.128:INFO::main: Logging initialized @911ms to org.seleniumhq.jetty9.util.log.StdErrLog

19:12:36.923 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4445

19:12:51.768 INFO [ActiveSessionFactory.apply] - Capabilities are: { "browserName": "firefox", "javascriptEnabled": true, "nativeEvents": false, "version": "" }

19:12:51.774 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.firefox.GeckoDriverService)

19:13:02.494 INFO [ActiveSessionFactory.apply] - Capabilities are: { "browserName": "firefox", "javascriptEnabled": true, "nativeEvents": false, "version": "" }

19:13:02.494 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.firefox.GeckoDriverService)

1

1 Answers

0
votes

Download chrome driver and try below command

To register a Selenium Grid Hub you need to use the following command:

>java -jar /Users/admin/selenium-server-standalone-3.14.0.jar -role hub

To register a Selenium Grid Node for ChromeDriver and Chrome you need to pass the absolute path of the ChromeDriver along with the Key and Value of the Registration URI as follows:

>java -Dwebdriver.chrome.driver=/path/to/chromedriver.exe -jar /Users/admin/selenium-server-standalone-3.14.0.jar -role node -hub http://<IP_GRID_HUB>:4444/grid/register