(I\'ve looked at many other similar posts on SO and have unfortunately not been able to solve this problem, so here goes...)
I\'m using Selenium WebDriver (C# implementa
The following worked for me:
@FindBy(id = "submit_action")
WebElement submitButton_;
...
public void clickSubmit() {
if (driver_ instanceof InternetExplorerDriver) {
((JavascriptExecutor) driver_).executeScript("arguments[0].fireEvent('onclick');", submitButton_);
}
else {
submitButton_.click();
}
}
As fireEvent is only supported by IE hence the alternative.
One more possible workaround can be like repeating clicking like:
Btn.click();
Btn.click();
Because 1st click just set focus and 2nd one performs the real click. It worked for me.
Is your site publicly available for test? Is your IE zoom level at 100%? It is a requirement for native click events to work from the documentation here
The browser zoom level must be set to 100% so that the native mouse events can be set to the correct coordinates.
If this doesn't work then it seems a bug in webdriver. You should open an issue here.
Having said this, you could probably go the Java script route in the meanwhile as a temporary solution. Something like,
driver.navigate().to("javascript:document.getElementById('yoursubmitbutton').click()");
It looks like it may be a problem with where the mouse click occurs. I tried using the Actions mechanism in Selenium to force a mouse-click with a bit of an offset. It successfully click the element:
new Actions(GuiOps.driver).MoveToElement(e).MoveByOffset(5,5).ClickAndHold().Release().Perform();