NoMethodError - Watir::Time:Class 的未定义方法“现在”
NoMethodError - undefined method `now' for Watir::Time:Class
每当我尝试与 Watir 元素交互时,我都会收到以下错误。
/Library/Ruby/Gems/2.0.0/gems/watir-6.0.1/lib/watir/wait/timer.rb:40:in `current_time': undefined method `now' for Watir::Time:Class (NoMethodError)
from /Library/Ruby/Gems/2.0.0/gems/watir-6.0.1/lib/watir/wait/timer.rb:6:in `initialize'
from /Library/Ruby/Gems/2.0.0/gems/watir-6.0.1/lib/watir/elements/element.rb:656:in `new'
from /Library/Ruby/Gems/2.0.0/gems/watir-6.0.1/lib/watir/elements/element.rb:656:in `element_call'
from /Library/Ruby/Gems/2.0.0/gems/watir-6.0.1/lib/watir/elements/element.rb:114:in `click'
from fund_cc.rb:8:in `<main>'
这是我的代码:
require 'watir'
# require 'time'
b = Watir::Browser.new(:chrome)#, :url => "http://localhost:9515")
b.goto "https://www.bankofamerica.com/"
contact_us= b.link(:text, "Contact Us")
contact_us.click
有谁知道如何解决这个问题?
我能够重现此行为。您可以通过调整 /lib/watir/wait/timer.rb
:
中的 current_time
方法在本地猴子修补您的 gem
def current_time
::Time.now.to_f # was Time.now.to_f
end
我建议在 https://github.com/watir/watir/issues 上记录问题。
这应该在版本 6.0.2 中得到修复。
来自Titus Fortner on the Watir-General mailing list:
The latest version of Watir attempts to use monotomic time where
supported and it looks like we grabbed the wrong Time class for where
it is not supported.
I just updated and pushed the fix to 6.0.2. You should be able to just
bundle update now.
每当我尝试与 Watir 元素交互时,我都会收到以下错误。
/Library/Ruby/Gems/2.0.0/gems/watir-6.0.1/lib/watir/wait/timer.rb:40:in `current_time': undefined method `now' for Watir::Time:Class (NoMethodError)
from /Library/Ruby/Gems/2.0.0/gems/watir-6.0.1/lib/watir/wait/timer.rb:6:in `initialize'
from /Library/Ruby/Gems/2.0.0/gems/watir-6.0.1/lib/watir/elements/element.rb:656:in `new'
from /Library/Ruby/Gems/2.0.0/gems/watir-6.0.1/lib/watir/elements/element.rb:656:in `element_call'
from /Library/Ruby/Gems/2.0.0/gems/watir-6.0.1/lib/watir/elements/element.rb:114:in `click'
from fund_cc.rb:8:in `<main>'
这是我的代码:
require 'watir'
# require 'time'
b = Watir::Browser.new(:chrome)#, :url => "http://localhost:9515")
b.goto "https://www.bankofamerica.com/"
contact_us= b.link(:text, "Contact Us")
contact_us.click
有谁知道如何解决这个问题?
我能够重现此行为。您可以通过调整 /lib/watir/wait/timer.rb
:
current_time
方法在本地猴子修补您的 gem
def current_time
::Time.now.to_f # was Time.now.to_f
end
我建议在 https://github.com/watir/watir/issues 上记录问题。
这应该在版本 6.0.2 中得到修复。
来自Titus Fortner on the Watir-General mailing list:
The latest version of Watir attempts to use monotomic time where supported and it looks like we grabbed the wrong Time class for where it is not supported.
I just updated and pushed the fix to 6.0.2. You should be able to just bundle update now.