Alex Rivera | Logout

Selenium WebDriver Click() fails with IE9

Asked 2012-01-03T21:32:59.623
8

(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:

  • Change window focus to currentWindowHandle
  • Click on the element's parent, then on the element
  • Add a long implicit wait
  • Add a long explicit wait (by sleeping 20 seconds)
  • Click a whole bunch of times on the element
  • Use Submit() instead of Click()
  • Send the keys "\n" to the element (Selenium reports this as an error)

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?

Edit
Report

3 Answers

1

I see multiple solution here, but i thought I would share what worked for me in case anyone else out there needed a different approach. I had a similar problem, for me the solution was as simple as clicking using a different method

For example

btn.Sendkeys(Keys.Enter); 
answered 2012-08-23T17:15:55.843
0

May be you need to set Enable Native Events to "true" when you are running it on IE and if you want to run the same code in FF and Chrome,then you need to enable Native Events to "true" in those Browsers too.

You can do that when you are setting the Browser on which you wish to run.

answered 2013-07-22T12:19:40.810
-1

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.

answered 2012-04-11T16:08:02.360

Your Answer