Inconsistent behavior of "Session::getCurrentUrl" in different drivers
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.
Well, calling it before the first request is explicitly documented as an unsupported behavior. We should throw an exception rather than fatal errors though.
OK. Closing.
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 ?
Throws DriverException
- MinkZombieDriver
- MinkBrowserKitDriver
- MinkGoutteDriver
Doesn't throw anything or result in Fatal Error
- MinkSelenium2Driver
- MinkSeleniumDriver
- MinkSahiDriver
fatal errors should be avoided indeed (well, SeleniumDriver is deprecated already, so no need to care).