5

I am running test cases on firefox and chrome browsers, it worked fine for me using selenium webdriver. But when it comes to using IE versions(9-11)-
1. I'm getting below mentioned error messages:

org.openqa.selenium.NoSuchElementException: Unable to find element with class name == tradeMenu (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 120.08 seconds

2. Can not click the option of the element. etc. I am using below config files in selenium:

latest selenium API (2.44)
IE driver server for 32 bits, windows7

3. ECLIPSE IDE 4.4.1

Thing is its working well with other browsers but getting so many same kind of issues with IE.

Note: I set all the prerequisites for IE 9 like setting up all the internet zones to same level, zoom level, environment variables etc.

Please suggest me if you have any resolution for this.

6
  • Although I dont question your IE setup, but you could try to run against saucelabs.com or testingbot.com environment. Both have enough free minutes for you to verify if its your setup or just IE in combination with your tests. I have had my struggles with IE9 and Selenium, IE has different way of focusing objects, clicking and is much slower. Commented Dec 15, 2014 at 10:08
  • Thanks Niels for this info i have signed in sauce labs but could you please elaborate what did the work around in your case i am failed as of now to test it in IE different browser. Commented Dec 15, 2014 at 10:44
  • I dont have the feeling my experiences are related, i dont remember getting these error messages. Commented Dec 15, 2014 at 11:05
  • Same experience here. Occasionally IE will behave differently than Chrome/Firefox. IE* was worst, but IE9+ are strange too. Did not found any rules or workarounds so far. I just try stuff, waiting for some other elements around at the page by ID, or even if desperate adding hard wait (gasp) for one second for dust (I mean JavaScript) to settle. I do hope someone has better solution. Commented Dec 15, 2014 at 15:47
  • @PeterMasiar : i read on seleniumhq.org that we can use css selector if we are opt for working on IE browser. So, as of now we can start using css selector rather than using X paths. If you will get more info on it please update us here . Commented Dec 16, 2014 at 7:41

5 Answers 5

2

Friends, i got the resolution .To get rid this problem we can have following code required in our code:

DesiredCapabilities caps = DesiredCapabilities.internetExplorer();
caps.setCapability("ignoreZoomSetting", true);
caps.setCapability("nativeEvents",false);
driver = new InternetExplorerDriver(caps);

I believe that we all are keeping the minimal requirement in executing IE browser right.

It helped me in my case hope this will be working for yours too. Do update if it works here.

1
  • I tried the code above having native events set to false but still get the same error > Unable to find element with id == txtLogin (WARNING: The server did > not provide any stacktrace information)
    – user10640
    Commented Jan 1, 2015 at 0:42
1

A couple thoughts:

  1. Drivers may render pages differently depending on window size. If IE is broken using the same window size, try maximizing the browser window.
  2. You didn't say whether you actually checked the page source in your IE test to confirm that the element it claims to not be able to find is actually there.
  3. In AJAX-heavy pages, I've seen different drivers handle sub-elements very differently, especially if they're "hidden" in some way. I have gone so far as to build action chains that hover over or click on each and every godforsaken child element all the way down to what I'm looking for, just to make sure that what I'm trying to get at is exposed.
1
  • 1. i have maximized the window page when execution starts the browser. 2. webelement is there on which i am testing on page source. 3.could you please elaborate what is the 3 point you have made it here Moreover , i tried using CSS selector but its not working in IE 11 i mean getting the same error message like Can not click the option of an element or element is not visible even though i put implicit wait having enough time. Friends, please update here if you have further suggestions. Commented Dec 17, 2014 at 7:17
0

Try to access the element on which the clicks are getting missed using CSS selector rather that id or xpath. This worked for me

2
  • 2
    Since the OP says in the comments of another answer that using CSS selectors doesn't work, you need to add a lot more information and explanation to make this a reasonable answer.
    – Kate Paulk
    Commented Apr 28, 2015 at 11:53
  • I've used CSS selector on IE 11 and it seems to work for me, the only difference that I can see comparing it with the approach you chose is that I used explicit wait instead of implicit. Try using explict wait and make sure the web element is active on the web page
    – Aniteysh
    Commented Apr 29, 2015 at 6:48
0

The problem here seems to be related to the actual HTML DOM load. The selenium web driver code to click the button or to select an element based upon the Id, Name or Link Text might be executing before the actual DOM has been loaded. For testing purpose, I tried to let the thread.sleep for 1 second before finding the element and it works fine which it was failing without adding the thread.sleep.

0

One suggestion is to try this, if it is the Click Function itself that doesn't seem to fire you might want to try something like the following:

driver.findElement(By.id("searchWhatever")).sendKeys(KEYS.ENTER);

IE Webdriver has a weird bug that doesn't respond to .click() it just ignores it and fails. So that would explain why it would work in Chrome but not IE.

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.