Mink icon indicating copy to clipboard operation
Mink copied to clipboard

Inconsistent behavior of "Session::getCurrentUrl" in different drivers

Open aik099 opened this issue 10 years ago • 5 comments

A lot of people are comparing current page url (obtained via $session->getCurrentUrl()) with desired url without even checking if a session was started.

If session isn't started upfront, then doing so (calling getCurrentUrl method) will:

  • result in different Fatal Errors for driver if this was first executed test
  • url opened last in that session (because we're doing soft reset and not changing current page url after test ends)

I'm not saying that each Session class method should detect if session is started, but at least getCurrentUrl method should return null when session isn't started.

aik099 avatar Oct 18 '15 17:10 aik099

Well, calling it before the first request is explicitly documented as an unsupported behavior. We should throw an exception rather than fatal errors though.

stof avatar Jan 14 '16 15:01 stof

OK. Closing.

aik099 avatar Jan 14 '16 15:01 aik099

Drivers for which we get a fatal error should be fixed though (fatal errors make it hard to understand failures). Do you know which drivers are triggering fatal errors instead of exceptions ?

stof avatar Jan 14 '16 18:01 stof

Throws DriverException

  1. MinkZombieDriver
  2. MinkBrowserKitDriver
  3. MinkGoutteDriver

Doesn't throw anything or result in Fatal Error

  1. MinkSelenium2Driver
  2. MinkSeleniumDriver
  3. MinkSahiDriver

aik099 avatar Jan 14 '16 19:01 aik099

fatal errors should be avoided indeed (well, SeleniumDriver is deprecated already, so no need to care).

stof avatar Mar 05 '16 09:03 stof