WebDriver tests run on mac, but on windows the PHP session cannot be deleted



  • We have a CakePHP application and our WebDriver tests run fine on mac. We have moved a copy of the app and the tests to a windows machine so tests can also be developed there. This is so we are able to use the mouse moving features of webdriver, and is not instead of using selenium grid. The whole application sits behind a login screen, so getting past it is essential. The CakePHP runs fine on windows when being used manually. WebDriver works well running on Windows with quick tests on other websites e.g. google.com, facebook.com When running on Windows, against the CakePHP application Chrome and Firefox open and are able to fill in the login form and submit. The login is successful (with the right information) but cakePHP is not able to create a new session. PHP error 'Session object destruction failed'. The CakePHP application then redirects back to the login page. Again, logging manually works fine without error, even if we use the browser instance created by the tests running. Is this a combination of our application and WebDriver or one of them individually? The issues only occur when WebDriver is attempting to Login to the application. Has anyone experienced anything like this?



  • I've handled this before by killing the process with driver.quit(); and then re-initializing the driver and getting the URL. That will definitely kill the session, because it's running in a new JVM. Since it's the same test, you can still pass strings and integers to the new driver. Simplified Example: driver.quit(); driver = new firefoxdriver(); driver.get("url"); I'm not sure if this is a bad practice, but it will definitely work. It's solved session problems for me in the past.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2