aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Internet cookies never get deleted while using selenium webdriver Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Internet cookies never get deleted while using selenium webdriver" Watch "Internet cookies never get deleted while using selenium webdriver" New topic
Author

Internet cookies never get deleted while using selenium webdriver

linda russel
Ranch Hand

Joined: Jan 05, 2012
Posts: 86



i have used the above methods in my setup method and will call this before my test is run.. but still if i login to my application and close it without logging out . next time i login i directly go to my dashboard page instead of going to the normal login page. how can i correct it?
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

Please define the word "i" in this phrase: "but still if i login to my application"
Does the word "i" refer to you personally as a human performing an action?
Or does the word "i" refer to the test you are running?

If the former, wouldn't the solution be to always make sure you log out?


JBoss In Action
linda russel
Ranch Hand

Joined: Jan 05, 2012
Posts: 86
Log out i can do in the normal circumstances if the tests completed normally. but in case the test stops in some intermediate page and fails and then closes the browser there is no way i can do a log out. i was looking for a way out there!


Thanks
linda russel
Ranch Hand

Joined: Jan 05, 2012
Posts: 86
i am referring to running my scripts. not doing it manually
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

Wouldn't a try-catch-finally block help? Something like this:



The other option is to do a general query before starting the test and see what that query returns. If it returns the portal home page, then send a logout and clear the cookies, and only then start the test.
linda russel
Ranch Hand

Joined: Jan 05, 2012
Posts: 86
very good idea. will try this! thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Internet cookies never get deleted while using selenium webdriver