giorgiosironi / phpunit-selenium

Selenium RC integration for PHPUnit
http://www.phpunit.de/
Other
602 stars 271 forks source link

selenium tests not working with phpunit laravel. #402

Closed Aqeel222 closed 4 years ago

Aqeel222 commented 7 years ago

i want my phpunit tests to run with selenium. i started testing some days ago and facing a lot of trouble.

i am stuck in one thing. when i run my phpunit tests/abcTest.php i got error that selenium is not running on port 4444. please find my attached files also.

i created some tests using selenium IDE. please take a look at attached files.

i ran selenium server with "java -jar selenium-*.jar -port 4444" and output is also attached as file.

every time i got this output.

i am new in selenium though i worked with phpunit before.

this occurs when i try to create new session. 2017-02-13_2015

this is how i run selenium. 2017-02-13_2029

my diresctory structure where selenium and drivers are 2017-02-13_2106

selenium IDE created test case 2017-02-13_2107

error that selenium is not running on port 4444. 2017-02-13_2109

PHP version: 7.0.6 Selenium server version: 3.0.1 Operating system: windows 8.1 Browser used + version: chrome + 56.0.2924.87

giorgiosironi commented 7 years ago

I don't see anything that is obviously out of place, so I would suggest checking if Selenium is responding by running curl -v localhost:4444 and if so, try to raise the debug level of the java -jar command to see if there is more helpful output.

Aqeel222 commented 7 years ago

one thing i am confused in is i got "Driver not found" error. please take a look below. 2017-02-15_1127

paulbriton commented 7 years ago

You need to add drivers (i.e. chromedriver.exe and operadriver.exe) in your system path. Then selenium will be able to detect them automatically.

I think you can also specify drivers path through driver capabilities.

Aqeel222 commented 7 years ago

i tried it also but same luck. Moreover i tried geckodriver for Mozilla Firefox. Test ran with no output. I see only blank page when test runs.

paulbriton commented 7 years ago

Are you sure that they're in your path ? Could you execute echo %PATH% in a windows command line ?

Aqeel222 commented 7 years ago

yes i can. when i run "echo %PATH%" i get same drive name where all webDrivers are. In my case it is C:\webDrivers.

paulbriton commented 7 years ago

You're using MinGW in order to run the tests. Have you tried launching them with the windows command line ? Does MinGW share system path with windows ? It really looks like that there is a problem with your path.

Aqeel222 commented 7 years ago

isn't it ok if i put all webDriver executables in the same directory as for selenium server.

paulbriton commented 7 years ago

Not it's not enough, that's what I told you before, they need to be present on your system path. So add your C:\webDrivers directory to your windows path. And try to launch test with windows command line.

Aqeel222 commented 7 years ago

i will try it tomorrow now. working on other module of the project. will surely tell you in any luck. thanks for your kindness