@Loligan

Почему не открывается браузер в Selenium webserver, но в Selenium webdrive всё отлично работает?

Пытаюсь завести Selenium server, но не получается, браузер Firefox 46.0. Использую behat и webdrive facebook. Пытаюсь запустить текст но не выходит, бразер не открыватся. Проверил свой Java проект на webdrive, всё отлично работает. Код php ниже:

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


}
  • Вопрос задан
  • 275 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы