ruby - 等待文本出现

标签 ruby cucumber watir page-object-gem

我想等待所需的文本出现。 我使用:

@browser.text('required text').when_present

我收到一个错误:

ArgumentError: wrong number of arguments (given 1, expected 0)

如何实现?我不想只等待文本而不依赖于 html 元素。

最佳答案

使用页面对象 gem,而不依赖于 html 元素:

@page.wait_until { @page.text.include? 'required text' }

Reference

关于ruby - 等待文本出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39265664/

相关文章:

html - 使用 join 时如何在 Rails View 中显示 HTML 元素数组(作为 HTML,而不是字符串)

ruby-on-rails - 获取虚拟属性值的方法

java - cucumber 没有将特征文件中数据表中的日期字符串序列化到我的 pojo 中的 LocalDate 字段

ruby - 重新打开 Ruby 类的奇怪问题

css - Watir/Cucumber 无法定位元素 : dd-field div. dd-arrow-box(使用 CSS 选择器*

ruby-on-rails - ActiveRecord has_many 具有匹配子对象的父对象计数

ruby-on-rails - cucumber 、 capybara 和 ElementNotFound

ruby-on-rails - capybara 访问无缘无故被卡住

ruby - 是否可以使用 watir 选择或突出显示文本框中的文本子字符串?

ruby - 如何使用 Ruby 的新 lambda 语法?