I am using selenium-* 4.0.0 in java to do some UI automation work, with a chrome webdriver. Essentially the flow is login -> page 1 -> logout.
It worked beautifully when driver loads the login page first time. But after I login, even after I loads logout page, which finishes successfully (I have waited long enough to make sure the final link appears), my 2nd loading of the login page fails, it directly goes to page 1, as the user session still exists. But I am trying to login 2nd time with another user.
I have tried
- loading logout page (logout page is loaded correctly, but user data still exists)
- using devtools to devTools.send(Network.clearBrowserCookies()); OR devTools.send(Network.clearBrowserCache());
- deleteAllCookies (Actually I don't want to delete all cookies. Just want to clear user login data)
- driver.quit
- driver.close
none works. I am doing the test through a test container, which has one webdriver. Not very willing to stop/restart the container just to get a new webdriver, before I have explored all possibilities to reuse the webdriver.
Can anyone please share some opinion on how to logout user in selenium webdriver? Many thanks