I experienced a similar problem a couple of days ago and I found the solution in my particular case.
===Using Selenium Webdriver, I wanted to click to the link of "First Link" and that would load content on the page.
Below a portion of code with structure alike my case:
<li class="first-link">
<a class="common-style" href="javascript:;" style="padding-left: 15px; padding-right: 15px;">First Link</a>
</li>
===The result is that the Webelement is supposed to be found and clicked but switching to the UI, nothing happened, no error was thrown either (element not found, element not ready for click, element disabled, etc).
After trying a couple of different ways to find the link through (xpath and css, didnt try by id because in my case there is no unique id), I was able to access and click the element with Selenium webdriver by css with the following value: li.first-link a
.
However, when I tried to access by xpath with the following value, this was 'found' in Firefox but click didnt work: .//li[a/text()='First Link']
.
The problem was a slight xpath syntax issue, that firebug from Firefox didnt report at all, in fact it found the link.
I changed the braces order like this: .//li/a[text()='First Link']
Now it works as expected, First Link is found and clicked and the javascript code that loads the page is fired.
My findings are:
* It is not a timing issue, so this does not happen because you try to click an element that is not ready. Otherwise we had solved this with an explicit Selenium wait...
- The problem is not that element is found and the javascript is not fired. You can try to execute directly javascript code and fire manually the events and see this does not work.
- This issue happens on Firefox 22,probably works for older versions from this browser. I cant provide information if this works on IE or Chrome. The issue itself is that even that there is a syntax conflict on xpath firefox does not throw an exception, that makes you think there is nothing wrong with your code, but there is.
- This is an unexpected unhandled behavior for Firefox. I have found a bug reported for this:
http://code.google.com/p/selenium/issues/detail?id=4757
SOLUTION SUGGESTED: verify your html structure, your xpath, try to find issues in the syntax, find different ways to access to the element.