2

I use selenium 2 with Phpunit. when I run a script I got this error during the run. PHPUnit_Extensions_Selenium2TestCase_NoSeleniumException: Error connection[28] to localhost:4444/wd/hub/session/edf323b4-c6ba-471a-9966-f2b9f3718084/url: Operation timed out after 60000 milliseconds with 0 bytes received

sometimes after several seconds and sometimes after 20+ minutes (memory: 48Mb ). it takes a lot of time to execute the script. ( it go over like 100 news in different pages ) but I don't believe that it is a problem ( sometimes it crush after seconds ). I already tried update the selenium and phpunit framework to last version but it doesn't helps.

Is there any option to continue the script after the connection crush? or avoid the crush?

I know that I can try to increase connection time, but I look for a different solution or explanation why it happens. any ideas?

thanks.

3
  • is possible you put your setUp() from PHPUnit. Commented Dec 18, 2014 at 20:02
  • 1
    @Antônio Carlos public function setUp(){ $this->setHost('localhost'); $this->setPort(4444); $this->setBrowser('firefox'); $this->setBrowserUrl('investing.com'); } Commented Dec 21, 2014 at 7:18
  • Check if Selenin are running in localhost:4444/wd/hub/session/ in your browser and edit setHost() with the adress of Selenium. For more information, look at codeception.com/11-12-2013/… and phpunit.de/manual/current/en/selenium.html Commented Dec 21, 2014 at 23:15

3 Answers 3

1

the problems with connection is because the CURL, I tried to change the php.ini and increase the timeout but it not works so I understand that probably selenium set the timeout on the fly or something. after a short grep I found this file:

phpunit/phpunit-selenium/PHPUnit/Extensions/Selenium2TestCase/Driver.php

in the construct method it possible to change the default of the 'timeout' variable. to make sure that this parameter never changed ( if you lazy to find all the places where selenium calls to this class ) set your default timeout to the 'seleniumServerRequestsTimeout' property ( not recommended ).

Sign up to request clarification or add additional context in comments.

Comments

1

I had the same issue and after days trying everything(I tried the solutions in this question too) without success to solve this issue, I decided to change the browser.

I downloaded the Chrome Driver and everything started to work without any problem. Which leads me to believe that can be some version conflict or something else. I used Selenium version 2.53.0 and PhantomJS version 2.1.1.

Comments

0

I encountered the same problem. It was caused by accessing to sessions and using session_id(). You should use session_write_close() to fix the issue.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.