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?

  • Any firefox or chrome browser webdriver spins up is a completely new/default browser profile. Did you have to do anything specific to get the site working? You could try pointing to your existing profile and see if it helps? stackoverflow.com/questions/6787095/…
    – Sam Woods
    Commented Jul 1, 2013 at 17:36
  • Nothing funky needed in the browser. The app works from any fresh device/ browser.
    – Jon Duffy
    Commented Jul 1, 2013 at 18:08
  • Is there an unsigned certificate that you need to create an exception for or anything like that?
    – Sam Woods
    Commented Jul 1, 2013 at 20:32
  • @SamWoods No there is nothing like that either
    – Jon Duffy
    Commented Jul 2, 2013 at 8:18

1 Answer 1


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 = new firefoxdriver();

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.

  • This example is using Java.
    – user8884
    Commented Jun 9, 2015 at 19:25
  • Hey, thanks for the reply. I'm not really in a position where I can test this though as I no longer have access to this code
    – Jon Duffy
    Commented Jun 9, 2015 at 19:26

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.