(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# implementation, version 2.15) to drive a fairly simple webpage. The page contains a form with two < input >'s for username and password, and one < input > for submitting the form. I can successfully enter values for username and password, but the Click() call on the submit button appears to have no effect.
Per other recommendations, I have tried the following tricks, none of which has worked:
Note that I have verified that the < input > button is indeed successfully found, so that doesn't seem to be a problem.
Also, note that I have verified the button does indeed work outside of Selenium-land. That is, I can browse to the site, enter login credentials, and click the submit button (and it works!).
Also, note that this problem is on IE. It does not occur for me with Chrome and FF7.
So that said, does anyone have any other ideas?
We can list the most common reasons for click problems as being one of the following: Wrong web element locations. The existence of a web element that obscures the web element that we want to click. The Selenium WebDriver works much faster than the response of the application.
Alternative of click() in Selenium We can use the JavaScript Executor to perform a click action. Selenium can execute JavaScript commands with the help of the executeScript method. The parameters – arguments[0]. click() and locator of the element on which the click is to be performed are passed to this method.
To verify, if the element can be clicked, we shall use the elementToBeClickable condition. A timeout exception is thrown if the criteria for the element is not satisfied till the driver wait time.
sendKeys() not working in Selenium WebdriverSelenium can run JavaScript commands with the help of the executeScript method. JavaScript command to be used is passed as a parameter to this method. To input text we shall first identify the edit field with the JavaScript method document. getElementsByClassName.
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()");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With