minkphp / MinkBundle

Mink library integration bundle for Symfony2
MIT License
60 stars 18 forks source link

Class 'Selenium\Client' not found in app\cache\test\appTestDebugProjectContainer.php on line 334 #24

Closed dbykadorov closed 12 years ago

dbykadorov commented 12 years ago

Config:

mink:
    base_url: http://domain.com/__test.php/
    default_session: selenium
    selenium: ~

Container source near line 334:

    protected function getBehat_MinkService()
    {
        $a = $this->get('behat.mink.selectors_handler');

        $instance = new \Behat\Mink\Mink();

        $instance->registerSession('symfony', new \Behat\Mink\Session(new \Behat\MinkBundle\Driver\SymfonyDriver(new \Symfony\Bundle\FrameworkBundle\Client($this->get('kernel'), array(), new \Symfony\Component\BrowserKit\History(), new \Symfony\Component\BrowserKit\CookieJar())), $a));
        $instance->registerSession('selenium', new \Behat\Mink\Session(new \Behat\Mink\Driver\SeleniumDriver('*firefox', 'http://guru-dev.com/__test.php/', new \Selenium\Client('127.0.0.1', 4444)), $a));
        $instance->setDefaultSessionName('selenium');

        return $instance;
    }

Where I can get \Selenium\Client? I don't see this in the docs.

robocoder commented 12 years ago

apply the patch from Behat/Mink#201

then run vendor/behat/mink/bin/install_deps

dbykadorov commented 12 years ago

@robocoder Thanks, I'll try it today

dbykadorov commented 12 years ago

@robocoder

What am I missing in this process or do not right (My Symfony have 2.0.11 version now)?

stof commented 12 years ago

@dbykadorov you autoload file needs to load the autoloading generated by Composer for the vendors it installed, or you need to register it manually in your own autoload file

dbykadorov commented 12 years ago

@stof simply require vendor/behat/mink/vendor/.composer/autoload.php?

Anyway now I can install all deps via my deps file.

dbykadorov commented 12 years ago

Its working ) Thank you all!

robocoder commented 12 years ago

So this can be closed?

In an sf2 project, we would register the namespace or prefix in app/autoload.php, e.g.,

$loader->registerPrefixes(array(
...
    'WebDriver' => __DIR__.'/../vendor/facebook/php-webdriver',
...
));
dbykadorov commented 12 years ago

@robocoder I've just required composer autoloader in app/autoloader.php

require_once __DIR__. '/../vendor/behat/mink/vendor/.composer/autoload.php';

And you can close this issue. Thanks! )