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 Answer
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.
-
-
1I 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