Selenium WebDriver Click issue in Internet Explorer

Using Selenium WebDriver on several Windows 7 test workstations.

FireBug Html of Button is listed below:

<input type="submit" style="border-color:Black;border-width:1px;border-style:solid;
font-family:tahoma,arial;font-size:0.7em;" id="UserPassword1_LoginButton" 
onclick="javascript:WebForm_DoPostBackWithOptions(new  WebForm_PostBackOptions(&quot;UserPassword1$LoginButton&quot;, 
&quot;&quot;, true, &quot;UserPassword1&quot;, &quot;&quot;, false, false))" value="Log      In" name="UserPassword1$LoginButton">

A snippet of Selenium C# code is below:

try
        {
            // Click on the button identified by Id
            IWebElement query = Driver.FindElement(By.Id(strControl));
            query.Click();
        }

On some windows test workstations the button click method works just fine. On other Windows 7 test workstations the button click does not press the button, The button is just highlighted.

I also have seen a similar problem where some times I have to include two:

query.Click();

commands in a row to get the button to press.

We have been trying to figure out what is different between environments but are not coming up with any solutions.

Any ideas on how to troubleshoot this problem or if anyone has a solution to this problem.

Thanks

Joe

Answers


You haven't said what browser(s) you're seeing the problem with, but I'm going to use my psychic debugging powers to deduce that you're probably talking about Internet Explorer. There are known challenges with the IE driver.

One set of challenges is that you need to set the zoom level of the browser to 100%, or the IE driver can't calculate the coordinates to click on properly. This is often the case when clicking works on one machine but not another, and is documented in the project wiki.

Another class of problems deals in particular with window focus. One alternative is to only use simulated events for the IE driver. This approach has its own pitfalls, but it may work in your situation. Since you mentioned that you're using C#, here is the code for the .NET bindings to disable native events.

InternetExplorerOptions options = new InternetExplorerOptions();
options.EnableNativeEvents = false;
IWebDriver driver = new InternetExplorerDriver(options);

Need Your Help

Invoking GCC as "cc" versus "gcc"

c linux gcc compiler-construction gnu

I am aware that on most GNU/Linux systems, GCC can be invoked by the name "cc" from the command line (as opposed to "gcc"). Is there any difference in GCC's behavior when it is invoked one way vers...

IP Fragmentation and Reassembly

networking tcp network-protocols fragmentation defragmentation

I am currently going through my networking slides and was wondering if someone could help me with the concept of fragmentation and reassembly.