- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在编写一个自动化测试程序,它将测试一些有时加载某些 AJAX 调用很慢的 Web 程序。例如,用户将单击“查询”,这将导致 15 到 90 秒的 HTML“加载”覆盖。搜索完成后,它将使用结果更新同一页面上的表格。
所以显然我可以像这样单独增加等待时间:
browser.td(:id => 'someId').when_present.some_action #=> will wait 30 seconds
browser.td(:id => 'someId').when_present(90).some_action #=> will wait *90* seconds
.when_present
上等待 90 秒像这样:
browser.some_default = 90
browser.td(:id => 'someId').when_present.some_action #=> will wait *90* seconds
when_present
.
Nor will implicit wait .
最佳答案
更新:此猴子补丁已合并到 watir-webdriver 中,因此在 watir-webdriver v0.6.5 中不再需要。您将能够使用以下方法设置超时:
Watir.default_timeout = 90
def when_present(timeout = 30)
message = "waiting for #{selector_string} to become present"
if block_given?
Watir::Wait.until(timeout, message) { present? }
yield self
else
WhenPresentDecorator.new(self, timeout, message)
end
end
require 'watir-webdriver'
module Watir
# Can be changed within a script with Watir.default_wait_time = 30
@default_wait_time = 90
class << self
attr_accessor :default_wait_time
end
module Wait
class << self
alias old_until until
def until(timeout = Watir.default_wait_time, message = nil, &block)
old_until(timeout, message, &block)
end
alias old_while while
def while(timeout = Watir.default_wait_time, message = nil, &block)
old_while(timeout, message, &block)
end
end # self
end # Wait
module EventuallyPresent
alias old_when_present when_present
def when_present(timeout = Watir.default_wait_time, &block)
old_when_present(timeout, &block)
end
alias old_wait_until_present wait_until_present
def wait_until_present(timeout = Watir.default_wait_time)
old_wait_until_present(timeout)
end
alias old_wait_while_present wait_while_present
def wait_while_present(timeout = Watir.default_wait_time)
old_wait_while_present(timeout)
end
end # EventuallyPresent
end # Watir
关于ajax - 是否可以全局增加 Watir-Webdriver when_present 等待时间?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19994867/
这是我正在使用的 Watir 代码: require 'watir-classic' browser = Watir::IE.new browser.link(:class, "Wizardbutto
在我们的应用程序中,我们有一些具有以下属性的输入标签: 我已经尝试了大多数 watir 输入法,但没有任何方法可以识别这个对象。任何人都可以为我照亮一点吗? 我的 watir 版本是 1.6.5。
我能够在下拉列表中设置一个选项,但随后我收到一条错误消息。我找到了一个会返回相同错误的在线网站: http://www.100candles.com/floating_candles.htm irb(
希望有人可以帮助我解决我在 Cucumber/Watir 中遇到的转义字符问题。 我有自动化测试设置。当我执行搜索时,我用来验证搜索是否返回正确结果的断言之一是检查页面中的文本。所以我的代码看起来像这
在文本字段中输入文本后,我需要自动执行键盘上的“Enter”键操作。 我试过 @browser.send_keys :enter但这并没有起到作用。也试过@browser.text_field(:na
我想知道 watir-webdriver 是否能够记录任何控制台错误的输出? 这相当于在浏览器中手动打开控制台并在页面加载时观察 JS 错误。我可以通过 watir-webdriver 捕获它并登录/
我想从以下值中找到并单击 Line Lo 值。以下 li 有超过 100 条记录具有相同的类名。如何找到 Line Lo 并单击该值。
有一个repository of tests对于 Mozilla 插件站点,尽管它是使用 Selenium 编写的。我想知道是否有 Watir 可用的真实示例,以便我可以看到专业人士如何实现该框架?
我在处理以下情况时遇到问题。 我正在编写测试脚本,它将让我使用谷歌浏览器登录到系统。 我正在从 excel 中读取数据。 第一组数据的用户名/密码组合不正确。 场景是当输入的密码不正确时,弹出窗口显示
在下面的 html 中 Name: 12121 如何使用 Watir 访问“12121”文本? 最佳答案 要获取潜台词 12121,请使用正则表达式。 gsub 执行搜索和替换操作。它将搜索所有非
我有以下div ... Test 我想提出一个 Watir 查询来测试它我想出了以下(我只需要第一个)... def item_present? # @
我想将一个元素拖放到另一个元素的位置,从 watir-webdriver 脚本中触发。 “拖放”是指拿起一个可拖动元素并将其释放到另一个元素上。 “可能”是指可以从 watir-webdriver 脚
使用 watir-webdriver 时,如何将控制组合键发送到元素? 目前我可以使用以下代码向元素发送一个字符串; $browser.frame(:id,"ws-txt-editor").div(:
我们的网络应用程序有一些事件代码来“格式化”粘贴到字段中的任何文本,这样任何 HTML 样式都不会破坏我们的数据。 预加载浏览器剪贴板以便我可以测试粘贴到输入字段的好方法是什么? 有没有什么方法可以通
require 'watir' ie = Watir::Browser.new ie.goto "http://www.wallpapers.com/windows/Wallpapers/Anim
我有一部分类似于以下内容的 HTML: Text Goes Here ... rest of table 没有 ID、没有标题、没有任何类型的描述符来轻松识别包含文本的 div。 当页面上发生
是否可以将 watir-webdriver 附加到已打开的浏览器窗口? 最佳答案 Watir-webdriver 建立在 selenium-webdriver 之上,目前这是一个待定的功能。 见:ht
我正在使用 Watir 来自动测试 web 应用程序。 在其中一个页面中,我有类似 htis 的内容 但是我能够识别 HTML 元素来访问它。 我需要访问 id="1"value="TIMESH
嗨,出于 SEO 的目的,我们需要访问 html 页面上的 META 标签。但是 Watir 不支持 META 标签。还有其他方法可以访问不受支持的 HTML 标签吗? 任何帮助表示赞赏。 嗨,我找到
我需要检查某个列是否显示在表中。 每列都有一个带有唯一 ID 的 TH 标题。 检查表中 TH 元素是否存在的最佳方法是什么? 这是表格代码的示例。 Nam
我是一名优秀的程序员,十分优秀!