How to start all tests with a clear session after browser crash?



  • Im using WebDriver and Python to automate a website. I have a suite of tests and sometimes running into the following problem. Test no.1 = Login to home page, navigate to Account page, perform some activity, Logout Test no.2 = Login to home page, navigate to Deposit page, perform some activity, Logout Problem: If Test no.1 has a catastrophic failure in Account page, then when Test no.2 kicks off, it logins to the account page instead of the home page. Question: How do I make sure that every test starts with a clean session, i.e. login always goes to the home page? Clearing the browser cookies and cache doesn't help. I have in my Test Teardown, the Close All Browsers keyword which clears the browser cache and closes the browsers.



  • I suggest you simply driver.get(URL) to your homepage. Not sure why you consider a hack, if that is what you need to recover from test failure.



Suggested Topics

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