Juliano
Juliano

Reputation: 463

Watir can't find elements I see in Chrome's DOM Inspector

Here's a study case:

<html>
...
<embed name="foo">
<embed name="bar">
...
</html>

I'm trying to reference the embed element named "bar" using Watir Ruby's API. The element is shown by Chrome's DOM Inspector but I can't find it using any of finding methods of Watir:

browser.embeds() # only <embed name="foo"> is found
browser.html.include? 'bar' # => false

Why does that happen? Why Watir does not show the complete HTML? If I have elements in different frames or dynamically inserted by Javascript init functions, will them be accessible using Watir?

Thanks

Upvotes: 6

Views: 950

Answers (1)

Željko Filipin
Željko Filipin

Reputation: 57262

If the element is in the frame, you have to use something like this:

browser.frame(:id => "frameid").embed(:name => "bar")

Upvotes: 3

Related Questions