boopathi boopathi - 8 months ago 81
Java Question

As a Automation(Selenium) tester , How to test "REMEMBER ME"(functionality) checkbox in Login Form

i am new to new selenium webdriver. i have one doubt, kindly give me a suggesstion. As a Automation(Selenium) tester , How to test "REMEMBER ME" checkbox in Login Form. Give me any sample code/script to test.

This is the scenario: (1).Enter the user name , password and click on the Remember me Checkbox.(2). Click on Login button. (3). After successfull login, close the browser without logout the account.(4). And if i open the URL, it needs to go to the home page with user already signed in. (5). Need to test whether this scenario is working or not


For Chrome (config):

You have to set the path to user-dir which will save all the login info after you login for the first time. The next time you login again, login info from the user-dir will be taken.

System.setProperty("", "res/chromedriver.exe");
DesiredCapabilities capabilities =;
ChromeOptions options = new ChromeOptions();
WebDriver driver = new ChromeDriver(capabilities);

Login for the first time:

//Your login script typing username password, check 'keep me signed in' and so on

Close the driver (do NOT quit):


Re-initialize the driver and navigate to the site. You should not be asked for username and password again:

driver = new ChromeDriver(capabilities);

The above can be implemented for firefox using a firefox profile.