...

Watir can't find items that I see in Chrome DOM Inspector

The case is considered here:

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

I am trying to reference an embed element named "bar" using the Watir Ruby API. The item is displayed in the Chrome DOM Inspector, but I cannot find it using the Watir search methods:

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

Why is this happening? Why doesn't Watir display full HTML? If I have elements in different frames or are dynamically inserted using Javascript initialization functions, will they be accessible using Watir?

thanks

+6
source share
1 answer

If the item is in a frame, you should use something like this:

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

Source: https://habr.com/ru/post/927582/


All Articles