执行ruby脚本报错TimeoutError,请大家帮吗看下吧

Python035

执行ruby脚本报错TimeoutError,请大家帮吗看下吧,第1张

因为这个元素在60秒内一直没有展现出来吧,所以报了超时,贴下这个方法的源码:

#

# Waits until the element is present.

#

# @example

# browser.button(:id =>'foo').wait_until_present

#

# @param [Fixnum] timeout seconds to wait before timing out

#

# @see Watir::Wait

# @see Watir::Element#present?

#

def wait_until_present(timeout = 30)

message = "waiting for #{selector_string} to become present"

Watir::Wait.until(timeout, message) { present? }

end

def until(timeout = 30, message = nil, &block)

end_time = ::Time.now + timeout

until ::Time.now >end_time

result = yield(self)

return result if result

sleep INTERVAL

end

raise TimeoutError, message_for(timeout, message)

end

希望对你有帮助

如果是弹出窗口页的话需要先把焦点转到这个窗口。###Ahelpermethodtowaitthepopupwindowtobeclosed#defwait_close_popup_windowi=0whilepage.driver.browser.window_handles.size>1sleep0.3i=i+0.3ifi>3breakend