Test \'Remember Me\' funcitonality using Selenium RC
Here is the scenario :
I am using Selenium RC with Junit(3.x) to automate a PHP based website. OS : Win XP
One of the scenarios i want to automate is that of the 'Remember Me' feature that appears when logging in.
The scenario is as follows :
1. Open the URL of the application.
2. Go to the Login page.
3. Enter the username and password and check the 'Remember Me' box. Click on the 'Login' button.
4. Once logged in, close the browser window without clicking on the 'Logout' button.
5. Open the browser again and go to the URL of the application.
6. Verify that the user is automatically logged in (i.e.e he should not need to go to the Login page to enter his credentials).
I have written a script to automate the above scenario.
The issue is that the above scenario is passing when tested manually, but when tested using the automation script, it fails (i.e. at step 6, the user is taken to the Login page)
I have checked that one the user gets logged in (at step 4), the application creates a cookie and i am able to print the contents of the cookie also.
However, when i close the browser and start it again, somehow, the browser is not able to read the existing cookie and thus asks the user to re-login.
Here is the script written in Junit :
public void testScenario6() throws InterruptedException, Exception
System.out.println("Scenario6 : Testing for Remember Me : Executing!");
String actual, expected;
//Login as a registered user with the 'Remember Me' check box checked
//Close the browser window
//Open the browser window with the application URL
//Verify that the user is directly logged in and the Welcome message appears with his username
actual = selenium.getText("//div[@id='header']/div/div/table/tbody/tr/td/span");
expected = "Welcome " + testCycleValueSet.getValue("username");
Assert.assertEquals("Login", actual.indexOf(expected)>=0, true);
Is it so that selenium deletes all cookies when closing or opening a browser?
Re: Test \'Remember Me\' funcitonality using Selenium RC
Yes its true that Selenium IDE does not work in IE.
It is implemented as a Firefox plugin only.
If you want to run selenium test scipts in IE, then you need to you use Selenium RC.
Selenium RC supports many different programming languages.
You can choose any 1 of your choice and code in it.