2

I have tested a scenario where I have to enter user credentials and click on login button using Selenium2 (version selenium2.19-standalone.jar)

driver.findElement(By.id("emailIdLogin")).sendKeys("[email protected]");
driver.findElement(By.id("passwordLogin")).sendKeys("test1234");
driver.findElement(By.id("submitLogin")).click

On click is performed on submit button but page is not loaded to new page. Whereas when I use driver.findElement(By.id("submitLogin")).sendKeys(Keys.ENTER) page is loaded to the next page. Please explain why click command is not loading the new page.

I am using Firefox 8.

3
  • 1
    Which Browser? If IE it could be because the physical mouse pointer is over the browser when the test is running (There are issues with IE picking up the physical mouse pointer location and using that instead of the pointer location set by selenium). Is it really a clickable button? Can you show us some HTML, that would help diagnose the issue. Are you expecting a JavaScript event to be fired on click? Possible the event isn't firing when a click occurs. Basically we need more info.
    – Ardesco
    Commented Feb 22, 2012 at 11:08
  • There are unfortunately LOTS of reasons a click can fail to work. IE is particularly problematic in that respect. Let us know which browser and we can help... Commented Feb 22, 2012 at 19:28
  • The choice of bindings that you use also seems to make a difference. I have seen this same problem with the Java bindings, but the Click() method in the C# works fine. Commented Feb 22, 2012 at 22:26

1 Answer 1

2

Not sure if it was a paste error but your last line should be:

driver.findElement(By.id("submitLogin")).click();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.