Finding a list of divs with a specific class in Watir

后端 未结 2 1175
一个人的身影
一个人的身影 2021-01-24 09:09

We have n-number of divs on the page with the same class name.

Foo is invalid
2条回答
  •  情话喂你
    2021-01-24 09:56

    If you upgrade to Watir 2.0 or if you use watir-webdriver gem, this would return all divs that have class errors and text (exactly) Foo is invalid (if that is what you want to do):

    browser.divs(:class => "errors", :text => "Foo is invalid")
    

提交回复
热议问题