Search code examples
facebooksymfonyphpstorm

PHP Fatal error: Class 'RemoteWebElement' not found in


I have a symfony project that run normal in command line:

php app/console server:run

But, I want to run inside PhpStorm. When I try to do this, it gives the fatal error:

PHP Fatal error: Class 'RemoteWebElement' not found in

I already tried to look the oficial documentation of the classe: http://facebook.github.io/php-webdriver/classes/RemoteWebElement.html. But I didn't found information that culd help me.

I also added the compose dependency:

composer require facebook/webdriver

But had no effect!

=======================================

I'll explain step-step how to get this the bug (It will be very long!):

I have:

  • PHP 5.5.9
  • PhpStorm 10.0.3
  • composer 1.0-dev (7117a5775ffdcdfd31bbd52a138a6f9c65e7e3c2) 2016-02-03

So, create a new symfony project (current version 3.0) and add composer dependencies:

symfony new project
cd project
composer update

Then, open this project inside of phpstorm and I configure settings for to run the project:

Settings -> Languages & Frameworks -> PHP

"PHP language level": 5.5

"Interpreter": 5.5.9

Add through plus(+) the PHP folder:

/usr/share/php

Click 'OK'

Now, try to run de project through PhpStorm by the shortcut: Ctrl+Shif+F10.

Will appear the bug:

PHP Fatal error: Class 'Symfony\Bundle\FrameworkBundle\Test\WebTestCase' not found in

Solve this by this way inside of PhpStorm: Settings -> Languages & Frameworks -> PHP -> PHPUnit Choose: "Use custom autoloader" And, in the field "Path to script", informe the autoloader's address. For example: /home/murilo/git/slu/app/autoload.php. Click 'OK'.

Again, try to run de project through PhpStorm by the shortcut:

Ctrl+Shif+F10

Will appear the bug:

PHP Fatal error: Class 'Doctrine\Tests\Common\Cache\CacheTest' not found in

Solve this through this command inside the project folder:

composer require maslosoft/cachetest:dev-master -n --no-progress

For the last time, try to run de project through PhpStorm by the shortcut: Ctrl+Shif+F10

Will appear the bug:

PHP Fatal error: Class 'RemoteWebElement' not found in

I'm at this bug.

Please, someone knows how I can overcome this bug? o.O


Solution

  • I struggled with the same exact issue as you have described. After breaking my head for most of the day with this problem, I found the issue.

    When you execute the command php app/console server:run in command line, it sets up a server and runs the website. However, when you run the project in PHPStorm, it doesn't actually run it as a server but runs it as a PHPUnit. What you need to do is configure a PHP Web Application in PHPStorm and run that.

    Check the image below where I have configured the website. When I run the Web Application, it will run by the url and it will show up in your browser.

    configuration window