I have encountered an issue for UI elements on IE browser. The link doesn’t respond to Selenium click commands. The same commands works fine on chrome browser.

I have used Actions also, but same problem it's not identifying the element.

code:

WebElement element = driver.findElement(By.xpath("//a[contains(@href, '#cwt_services')]"));

Actions action = new Actions(driver);

action.moveToElement(element).perform();

WebElement subElement = driver.findElementByXPath("//*[@id=\"yui-gen4\"]/a");

action.moveToElement(subElement);

action.click();

action.perform();

Image of the code:

enter image description here

Please help me how to handle this scenarios on IE browser.

  • Use JavaScript Executor to click on the element in IE browser. – Bharat Mane Aug 9 at 10:47
  • What is the reason for moving to element and then without any interaction on it moving to subElement? Are you sure your code logic implements the expected user behavior? – Alexey R. Aug 9 at 10:49
  • In your code you're referring to yui-gen4, while your list element has id yui-gen1. I suppose the displayed HTML fragment is not complete, else it wouldn't work in Chrome. – Bouke Oct 8 at 12:21

If you add a 5 second pause (for investigation purpose ONLY - remove after investigation) does it help at all with the issue?
If so u have a timing issue and will probably want a polling (explicit) wait on the element

You can find that element by using two more methods if this is not working. Try using CSS selectors or using a tag name a, because XPath doesn't work always.

Also, I assume that you have put these lines in your code:

System.setProperty("webdriver.ie.driver", 
                   "pathofchromedriver\\IEDriverServer.exe");

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.