如何更改 Watir-Webdriver 中的页面加载超时(.click 方法中的超时) [英] How do I change the page load Timeouts in Watir-Webdriver (timeout in .click method)

查看:29
本文介绍了如何更改 Watir-Webdriver 中的页面加载超时(.click 方法中的超时)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码

browser.link(:text => 'Generate Report').click  
browser.radio(:value => 'byTotalValue').wait_until_present(180)  

它请求生成报告,然后通过在报告页面上查找元素来等待报告.报告最多可能需要 2 分钟才能出现.

which requests that a report be generated and then waits for the report by looking for an element on the report page. The report can take upwards of 2 minutes to appear.

发生的事情是 60 秒后从 click 方法引发 Timeout::Error.我怀疑 Watir-Webdriver 在 click 方法中实现了某种形式的等待页面加载,但我没有看到调整值的方法.

What is happening is a Timeout::Error is being raised from the click method after 60 seconds. I suspect that Watir-Webdriver has implemented some form of wait for page load within the click method but I don't see a way to adjust the value.

任何帮助理解这一点将不胜感激.

Any help understanding this would be appreciated.

推荐答案

我会尝试延长客户端超时时间:

I'd try upping the client timeout:

client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 180 # seconds – default is 60

b = Watir::Browser.new :firefox, :http_client => client

这篇关于如何更改 Watir-Webdriver 中的页面加载超时(.click 方法中的超时)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆