2021年3月31日星期三

Rails Watir: Wait for 5 seconds before reading element text

I have a website that has a <h1> element.

This element has value x as innerhtml at page load and value y after z seconds.

I don't know what the values of x and y are, because they change frequently. z could be anywhere between 0 to 5. I can't use wait_until or wait_while because of this. So this really wouldn't work, because I don't know what to wait for.

Watir::Wait.until(5) {    element.text == "abracadabra"  }  

So really I need to wait for 5 seconds and then check the text of the element. Does Watir has some kind of timout function I can use? Like the javascript setTimeout()?

https://stackoverflow.com/questions/66885420/rails-watir-wait-for-5-seconds-before-reading-element-text March 31, 2021 at 05:52PM

没有评论:

发表评论