Selenium Web driver - webpage Session timeout check
Is there a way to test the session timeout of a webpage using selenium webdriver?
once logged in - try running with a try-catch to verify for the logout page with the loop to run on your estimated session timeout time.
Prob can use explicit wait - once you exit that loop, capture the systime again and derive the diff.
I really think testing a timeout is really a waste of end to end automation time. Typically most website have their sessions last anywhere between 1 and 4 hours. If you're using cloud or other external 3rd party resources, this can be an easy waste of lots of $.
This is easier done in a unit test where the Timer object can be mocked out and substituted with a fake.
As for testing some of the mechanism some of the end effects (the user being booted out of a session) of the user is to use code to alter the session in some way.
- In an external cache based mechanism (redis, memcached), you can use an external connection to alter the cache contents making the server think the session in expired.
- In server tracked sessions. This is much harder you may need to ask your devs to give you a hook.