I am attempting to set up selenium with php to run basic automation programs. So far I have downloaded selenium and gecko driver. Selenium is located at localhost:4444. All my selenium files have come from the following link: https://code.google.com/archive/p/php-webdriver-bindings/ and are saved in a htdocs folder within my MAMP.
Here is my 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");
$element->sendKeys(array("selenium google code" ) );
$element->submit();
$webdriver->close();
?>
When I run this through my localhost:8888, it returns:
stdClass Object ( [sessionId] => [value] => stdClass Object ( [error] => invalid session id [message] => No active session with ID [stacktrace] => ) [status] => 6 )
Any help would be so greatly appreciated! Thanks!