0
$driver = RemoteWebDriver::create($seleniumUrl, DesiredCapabilities::chrome(), 60 * 1000, 60 * 1000);
$driver->get('http://unknown-domain/'); // chrome shows "This site can't be reached" error page
$driver->getTitle(); // command hangs for 60s and dies with "operation timed out after 60003 milliseconds" error

Problem:
I do not want to wait 60s - its just a waste of time.
I want to get result as fast as possible: it can be an exception or it can be, for example, title of error page.

Question:
How can i do that?

Oleg Golovanov
  • 905
  • 1
  • 14
  • 24
  • You have to wait for timeout to end, because you're using implicit wait here. Reduce it. Also I'm pretty sure your code fails on second step, not on getTitle(). Traceback would be appreciated. If you just have a risk to encounter not working domain (and not explicitly trying to), I would suggest checking it's staus code first. Use https://github.com/guzzle/guzzle for example – Furious Duck Nov 19 '20 at 18:31

1 Answers1

0

Your timeout is too long. You need to reduce it. Change the 60*1000 to a smaller value.

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
boatcoder
  • 17,525
  • 18
  • 114
  • 178