6

I added a DOM element (a link) with jQuery. I can see the element in Firebug, but for some reason Selenium can't find it. What is going on here?

Note: there is no AJAX involved, so the DOM element is added almost immediately.

== EDIT ==

Here's some code (using jQuery) that appends a link to the end of the document:

$element = $("<a id="foo" href="#"></a>");
$element.appendTo($("body"));

I'm using Capybara (with Selenium) to find the link and click it, like so:

find("#foo").click

I was having no problems with Capybara or Selenium until I started adding elements to the DOM with jQuery.

Matt Fichman
  • 5,458
  • 4
  • 39
  • 59

1 Answers1

6

Try to use waitForElementPresent in your test code.

Jigar Shah
  • 2,576
  • 6
  • 31
  • 53