Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

watir

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

I put all the instructions into the html from the beginning and use jQuery to hide and unhide the relevant parts.

How can I use watir's waiter to wait for only text that is visible?

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

like image 930
user89021 Avatar asked Apr 07 '26 10:04

user89021


1 Answers

Don't use Watir's text method. It is very quick and dirty, and has lots of misgivings, many not even related to this issue about visible text. Solid Watir test developers will avoid it. I almost never use it myself, and only when I am doing something extremely quick and dirty. Also, it is implemented differently with different browsers.

Instead you should access the text you care about in terms of the actual element that it is in. You should reference the div or whatever.

like image 51
Bret Pettichord Avatar answered Apr 19 '26 23:04

Bret Pettichord



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!