Modelizer / Laravel-Selenium

Selenium Testing for Laravel 5
MIT License
108 stars 33 forks source link

Chrome binary not found while doing headless testing. #17

Closed spescina closed 8 years ago

spescina commented 8 years ago

I am on a vagrant ubuntu 64 box. When I run phpunit I have this WARN - Exception: unknown error: cannot find Chrome binary and no tests are executed. What's up? linux-chrome is present in vendor/bin and if I run it from command line it works...

Modelizer commented 8 years ago

Can you run this command via tinker mb_strtolower(PHP_OS) and tell us what value you are getting?

spescina commented 8 years ago

"linux"

kre8or69 commented 8 years ago

Sucks you're having issues!

Is it a GUI version of ubuntu? and do you have chrome installed and are actually able to run it?

Hope we can get you up and running!

spescina commented 8 years ago

nope. It's a custom vagrant box based on the scotchbox image... (https://box.scotch.io/)

Modelizer commented 8 years ago

@spescina is GUI is not enabled on your VM? :scream:

But still it should not say WARN - Exception: unknown error: cannot find Chrome binary .

Fork this repo or make direct changes in vendor/path/to/BootSelenium.php and make some changes in BootSelenium file line 62. I think Laravel is not able to get proper directory because as you said linux-chrome file is present in vendor/bin folder.

Modelizer commented 8 years ago

@spescina finding a solution for this problem is baseless if GUI is not enabled. Please try it on your host machine.

spescina commented 8 years ago

@Modelizer sorry, I can't understand...

I have a Windows 10 host. I use the scotchbox vm without GUI. I would be able to run selenium tests in a headless environment like I do with firefox and without your package (only with firefox headless, selenium and phpunit-selenium). Can't I?

spescina commented 8 years ago

@Modelizer wait. I'm forgetting something, sorry. Before I war running selenium and firefox through xvfb with this command alias selenium='DISPLAY=:0 xvfb-run --auto-servernum java -jar /var/www/app/tests/bin/selenium-server-standalone.jar

Modelizer commented 8 years ago

This is the point! We haven't integrated any headless functionality in this package. But it would be a good idea. :+1:

You can contribute if you like by adding an option when you boot up selenium server like php artisan selenium:start --headless and we can specify that this feature is only available for linux machine right now. :)

Thanks.

deleugpn commented 7 years ago

I found this topic while searching for the issue of "cannot find Chrome Binary". When running a Linux without GUI, Chrome doesn't work and thus we can't run tests, is that it?

Modelizer commented 7 years ago

What exception do you get? Please give a full exception list to get to know what exactly happening.

deleugpn commented 7 years ago

I'm not using Laravel-Selenium, so I'm not sure if that would help. I'm using Laravel Dusk as is (out of the box). I just want to know if conceptually it is possible to have your tests running on a browser driver even though the Linux distribution have no GUI whatsoever.

[06:32 AM]-[root@php7]-[/var/www/html/project]-[git master]
# php artisan dusk
PHPUnit 5.7.11 by Sebastian Bergmann and contributors.

E                                                                   1 / 1 (100%)

Time: 25.83 seconds, Memory: 8.00MB

There was 1 error:

1) Tests\Browser\LoginTest::it_should_see_email_error_message
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http                                                                                                                                                                                                POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","pl                                                                                                                                                                                               atform":"ANY","chromeOptions":{"binary":"\/usr\/lib64\/chromium-browser\/chromed                                                                                                                                                                                               river","args":["no-first-run"]}}}

Operation timed out after 5001 milliseconds with 0 out of -1 bytes received

/var/www/html/project/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:287
/var/www/html/project/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:121
/var/www/html/project/tests/DuskTestCase.php:42
/var/www/html/project/vendor/laravel/dusk/src/TestCase.php:180
/var/www/html/project/vendor/laravel/framework/src/Illuminate/Support/helpers.php:639
/var/www/html/project/vendor/laravel/dusk/src/TestCase.php:181
/var/www/html/project/vendor/laravel/dusk/src/TestCase.php:111
/var/www/html/project/vendor/laravel/dusk/src/TestCase.php:85
/var/www/html/project/tests/Browser/LoginTest.php:24

ERRORS!
Tests: 1, Assertions: 1, Errors: 1.

[06:34 AM]-[root@php7]-[/var/www/html/project]-[git master]
Modelizer commented 7 years ago

I think this error should go at laravel dusk repo... Because dusk is built on top of facebook php web driver and this package is using phpunit/phpunit-selenium