Hi,
I have the following test case which needs to be automated.
1> We have html page wherein user gives username and password and then clicks on "signin".
2> When we click on "signin", server sends call back url with 302 response.
3> Browser follows 302 and goes to the callback url after which some other actions happen.
I was trying to automate the above scenario using selenium webdriver HTMLUnitDriver. Sorry if I am asking very basic question, I am newbie to Webdriver.
driver.get(url);
//driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
System.out.println("Source after initial implicit wait is " + driver.getPageSource());
driver.findElement(By.name("username")).sendKeys("testuser");
driver.findElement(By.name("passwd")).sendKeys("password");
driver.findElement(By.name("signin")).submit();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
In the above code, when I do submit, it should take me to the redirected url as I observed with the browser but Webdriver always lands me on the same page without following the redirect/callback url.
As per the documentation, get is supposed to follow redirect urls.
public void get(java.lang.String url)
Load a new web page in the current browser window. This is done using an HTTP GET operation, and the method will block until the load is complete. This will follow redirects issued either by the server or as a meta-redirect from within the returned HTML. Should a meta-redirect "rest" for any duration of time, it is best to wait until this timeout is over, since should the underlying page change whilst your test is executing the results of future calls against this interface will be against the freshly loaded page. Synonym for
WebDriver.Navigation.to(String)
.
Can anyone please let me know what I could be doing wrong or if there's any basic problem with my approach?
Thanks in advance.
~Subramanyam