3

I am testing Coursera.org, I have given UserName, Password, Email, and got logged in. when again running the scripts to test other functionality it requires me to login again. Is there any solution for this? that I shouldn't have to login for a number of times to test other functionality.

1
  • 1
    Each browser window is a brand new session and cookies won't be remembered. Change testing approach. big topic. learn more about session testing Aug 13, 2017 at 10:39

1 Answer 1

5

Probably because you close the browser at the end of each test. Which is good because then you test in isolation. But now the session's data is cleaned. Each new Selenium browser starts with a new clean session in order to not influence new test runs with older cookies and such.

If you want to re-use the current session, only close/quit the browser at the end of the test suite.

You could try to save all the cookies and sessions info after the first test and load them before the next test, but that feels overly complex.

2
  • Means I have to login each time when I run Test case
    – M-Waseem
    Aug 13, 2017 at 13:35
  • 1
    I would reuse the driver and close it at the end of the test suite. Never had problems with it. Aug 13, 2017 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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