Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

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.

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.

share|improve this question
    
This question has the robotframework tag, but this question appears to have nothing to do at all with robotframework. –  Bryan Oakley Aug 9 at 12:24

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
Hi Peter, I guess I could force the homepage on the second login. But that would look like a hack. –  Haris Jul 17 at 0:18
    
This should be a comment, not an answer. Could you please repost as a comment and delete your answer? –  Kate Paulk Jul 17 at 10:44
    
This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. –  Kate Paulk Jul 17 at 10:44
    
Hi Kate, I think thats what I did. I clicked the <Add Comment> button to respond. Sorry this is my first time with StackExchange. –  Haris Jul 17 at 16:56
    
Thanks Peter. I guess I could simply update the keyword to switch to the home page if login lands elsewhere. –  Haris Jul 17 at 16:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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