此線程中提到的方法不再適用於Selenium Webdriver v3。
您將需要爲執行命令添加睡眠。
module Selenium::WebDriver::Remote
class Bridge
def execute(command, opts = {}, command_hash = nil)
verb, path = commands(command) || raise(ArgumentError, "unknown command: #{command.inspect}")
path = path.dup
path[':session_id'] = session_id if path.include?(':session_id')
begin
opts.each { |key, value| path[key.inspect] = escaper.escape(value.to_s) }
rescue IndexError
raise ArgumentError, "#{opts.inspect} invalid for #{command.inspect}"
end
Selenium::WebDriver.logger.info("-> #{verb.to_s.upcase} #{path}")
res = http.call(verb, path, command_hash)
sleep(0.1) # <--- Add your sleep here.
res
end
end
end
注意:這是因爲你是猴子修補私有API的測試減慢很脆的方式。
來源
2017-07-25 08:10:32
fny
THX的暗示!以防萬一`page`不可用,要麼包括`Capybara :: DSL`或者替換爲`Capybara.current_session` – RngTng 2012-11-13 12:20:09