I have webform which I am filling with credentials. Then I want to click on login link. But it still gives me the same page in which I am clicking.
HtmlForm loginForm = loginPage.getFormByName("Login1Form");
HtmlTextInput inLoginName = loginForm.getInputByName("loginId");
HtmlPasswordInput inPassword = loginForm.getInputByName("passwd");
HtmlTextInput inCaptcha = loginForm.getInputByName("checkcode");
inLoginName.setText(loginName);
inPassword.setText(password);
inCaptcha.setText(captcha.toUpperCase());
//HtmlElement loginLink =loginPage.getFirstByXPath("//a[@href=\"javascript:submitPB('9');\"]");
HtmlAnchor loginLink = loginPage.getAnchorByHref("javascript:submitPB('9');");
HtmlPage resultPage = resultPage = loginLink.click();
And resultPage even has same object id as loginPage has. I've tried webClient.wait methods and all I've found here. But nothing is working for me.
Here is html link I need to click on
<a href="javascript:submitPB('9');">
<img src="images/pf/login-001.gif" width="43" height="21" border="0" alt="">
</a>
Any ideas please? Thanks
EDIT:// WebClient settings:
mWebClient = new WebClient(BrowserVersion.FIREFOX_3_6);
mWebClient.getOptions().setJavaScriptEnabled(true);
mWebClient.getOptions().setRedirectEnabled(true);
mWebClient.setAjaxController(new NicelyResynchronizingAjaxController());
mWebClient.getCookieManager().setCookiesEnabled(true);