phpunit-selenium icon indicating copy to clipboard operation
phpunit-selenium copied to clipboard

Throw error on "The Selenium Server is not active on host localhost at port 4444."

Open wulftone opened this issue 10 years ago • 22 comments

I read through some of the old issues and found that people wanted it to NOT throw an error if selenium wasn't running.... however, this isn't great if there's something wrong with selenium (as sometimes happens) and it fails to connect during functional tests.

I would like an option to throw an error if selenium isn't running. Or if someone knows how to override the default (turning those tests into skipped tests), that'd be great!

Thanks!

wulftone avatar May 28 '14 19:05 wulftone

+1

sensorario avatar May 29 '14 07:05 sensorario

This could be a bootstrap configuration like the existing:

PHPUnit_Extensions_Selenium2TestCase::shareSession(true);

such as

PHPUnit_Extensions_Selenium2TestCase::errorOnServerUnavailable(true);

and should raise PHPUnit_Framework_Error exceptions to fill the test results with E. I would accept a PR.

giorgiosironi avatar May 31 '14 09:05 giorgiosironi

dont know if this error is related to this issue or not fsockopen(): unable to connect to localhost:44444 (Connection refused) in /usr/share/php5/PEAR/PHPUnit/Extensions/SeleniumTestCase.php on line 738

please help !!

shabfactor avatar Feb 03 '15 21:02 shabfactor

Where does the 44444 port number come from? Is it intentionally 44444 or confused with 4444?

zerkms avatar Feb 03 '15 21:02 zerkms

it is intentionally as per our own environment

shabfactor avatar Feb 04 '15 00:02 shabfactor

Is there anything listening localhost:44444? How did you check it?

zerkms avatar Feb 04 '15 00:02 zerkms

netstat -a | egrep 44444 gives me following tcp 0 0 server.company.co:44444 localhost:38278 ESTABLISHED

shabfactor avatar Feb 04 '15 00:02 shabfactor

netstat -nlp | grep 44444 ?

zerkms avatar Feb 04 '15 00:02 zerkms

tcp 0 0 :::44444 :::* LISTEN

shabfactor avatar Feb 04 '15 00:02 shabfactor

telnet localhost 44444 ?

zerkms avatar Feb 04 '15 00:02 zerkms

user@server:~> telnet localhost 44444 Trying ::1... Connected to localhost.

shabfactor avatar Feb 04 '15 00:02 shabfactor

And phpunit-selenium connects to it from the same machine?

zerkms avatar Feb 04 '15 00:02 zerkms

yes pear list -a PHPUnit 4.0.14 stable PHPUnit_Selenium 1.2.7 stable

shabfactor avatar Feb 04 '15 00:02 shabfactor

Did it ever work? I don't see how that error can be possible in your case

zerkms avatar Feb 04 '15 00:02 zerkms

good question !!! i dont know it ever worked or not as i am the new guy doing this as last person left and i have no idea why it is not working have checked everything possibly could go wrong !!

shabfactor avatar Feb 04 '15 00:02 shabfactor

Next my step to debug it would be to create a tiny php script that would connect to that port using fsockopen as well and see if it succeeds.

zerkms avatar Feb 04 '15 00:02 zerkms

ahh ok i didn't tried that thanks will check !!

shabfactor avatar Feb 04 '15 00:02 shabfactor

hey now getting different error: Invalid response while accessing the Selenium Server at 'http://localhost:44444/selenium-server/driver/': Timed out after 30000ms

shabfactor avatar Feb 04 '15 01:02 shabfactor

What has changed in the setup?

Now it looks like there are no browsers configured in selenium (on first glance)

zerkms avatar Feb 04 '15 01:02 zerkms

by changing PHPUnit/Extensions/SeleniumTestCase.php. The lines: throw new PHPUnit_Framework_Error($buffer, $e->getCode(), $e->getFile(), $e->getLine(), $e->getTrace()); to throw new PHPUnit_Framework_Error($buffer, $e->getCode(), $e->getFile(), $e->getLine(), $e);

shabfactor avatar Feb 04 '15 01:02 shabfactor

I don't believe this would make such a change

zerkms avatar Feb 04 '15 01:02 zerkms

yeah right but that is what i changed !!

shabfactor avatar Feb 04 '15 01:02 shabfactor