Selenium IDE - onclick jQuery handler not starting

I am trying to check the page using the FF Selenium IDE plugin.

There is a menu structure such as the following.

<ul class="parent">
   <li class="child"><span><a href="something.html">link text</a></span></li>
   <li class="child"><span><a href="somethingelse.html">other text</a></span></li>
<ul>

The li elements have a hang event attached to them. These hover events log a click event on the actual link tag. (I simplified some of the JavaScript to simplify)

  var menu = $('ul.parent');

  $("> li.child", menu).hover(function () {

    $(this).find('> a').click(function () {             
      $(this).parent().addClass('active-trail');
      return false;
    });
  }, function() {});

If you are using Selenium, I click one of these links, then I expect the handler to be called. This is not the case, and the click just executes (and the subsequent link, not false).

I tried (after reading other answers) mouseUp and mouseDown. I also tried using fireEvent to first hover over li (to fire the hover event) and then another fireEvent click on the anchor .. but that didn't work either.

, . Selenium jquery, , , !

, .

+5
2

fireEvent(), , ?

onClick, fireEvent(locator, "click") not fireEvent(locator, "onClick").

, , , Selenium IDE .

Selenium , .

+2

xpath i.e.

selenium.Click( "= XPath/:: Li [ (,." - ")] [2]/: " )

+1

All Articles