Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 216
Juliano Avatar asked Oct 12 '12 15:10

Juliano


1 Answers

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

browser.frame(:id => "frameid").embed(:name => "bar")
like image 58
Željko Filipin Avatar answered Nov 25 '22 23:11

Željko Filipin