Answer the question
In order to leave comments, you need to log in
Why doesn't the browser open in Selenium webserver, but everything works fine in Selenium webdrive?
I'm trying to start Selenium server, but it doesn't work, Firefox 46.0 browser. I use behat and webdrive facebook. I'm trying to run the text but it doesn't work, the browser won't open. Checked my Java project on webdrive, everything works fine. PHP code below:
<?php
use Behat\Behat\Context\Context;
use Behat\Behat\Context\SnippetAcceptingContext;
use Behat\Gherkin\Node\PyStringNode;
use Behat\Gherkin\Node\TableNode;
use Behat\Behat\Tester\Exception\PendingException,
Behat\Behat\Hook\Scope\BeforeScenarioScope,
Behat\Behat\Hook\Scope\AfterScenarioScope,
Facebook\WebDriver\Remote\DesiredCapabilities,
Facebook\WebDriver\Remote\RemoteWebDriver;
/**
* Defines application features from the specific context.
*/
class FeatureContext implements Context, SnippetAcceptingContext
{
/**
* Initializes context.
*
* Every scenario gets its own context instance.
* You can also pass arbitrary arguments to the
* context constructor through behat.yml.
*/
/**
* @var \RemoteWebDriver
*/
protected $webDriver;
protected $baseURL;
public function __construct()
{
$this->baseURL = "http://www.toster.ru/";
}
/**
* @Given I have a web browser
*/
public function iHaveAWebBrowser()
{
throw new PendingException();
}
/**
* @When I load the homepage
*/
public function iLoadTheHomepage()
{
$this->webDriver->get($this->url);
}
/**
* @Then I should see :arg1
*/
public function iShouldSee($arg1)
{
throw new PendingException();
}
public function openWebBrowser(BeforeScenarioScope $event)
{
$capabilities = DesiredCapabilities::firefox();
$this->webDriver = RemoteWebDriver::create("http://localhost:4444/wd/hub", $capabilities);
}
public function closeWebBrowser(AfterScenarioScope $event)
{
if ($this->webDriver) $this->webDriver->quit();
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question