Does watir support browser.text.include? count text inside invisible divs? If so, how to search only visible text?

Does watir support browser.text.include? count text inside invisible divs? If so, how to search only visible text?

I put all the instructions in html from the very beginning and use jQuery to hide and show the corresponding parts.

How can I use wair waiter to wait only for visible text?

My problem is that the waiter always returns true, even before I made certain text visible.

+3
source share
3 answers

What happened with:

text_from_all_my_visible_divs = br.div(:id, 'divs I care about').divs.select do |div|
  text_i_care_about(div) && div.visible?
end

def text_i_care_about(div)
  div.text =~ /regexp/
end

.Visible? is in unit tests, it is official, do not be afraid of it :)

Alan

+1
source

Watir. , , . Solid Watir . , - . , - .

, , , . div - .

+3

include? , . . WTR-433.

# visible?, ( ).

What are you trying to do? If you have a lot of text on the page and you want to show only some of them, you can put the text in several divs and then see if the div is displayed.

0
source

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


All Articles