Selenium Login not logging out

Viewed 54

I have a application that does multiple tests on the same website, and I need to login multiple times to the same webpage. However when I click logout after one tests finishes, then login to the next, the driver automatically logs me in, which I dont want. The only way around it I know of is to close the driver, but I dont want to have to always close and relaunch chromedriver. Clearing cache does not fix it.

Is there another way to ensure chrome doesn't login automatically?

1 Answers

Once you signout as a specific user, you need to delete all the cookies before signing in as the next user as follows:

driver.delete_all_cookies()

which is used to delete all cookies.

Related