我的两个场景 -
1)首先
@driver.manage.timeouts.implicit_wait = 30
@wait = Selenium::WebDriver::Wait.new(:timeout => 45) # Time greater than implicit
@wait.until {@driver.find_element(:tag_name => "body").text.include?("hey")}
Run Code Online (Sandbox Code Playgroud)
这给了驱动程序45秒搜索文本(这是预期的)
2)第二
@driver.manage.timeouts.implicit_wait = 30
@wait = Selenium::WebDriver::Wait.new(:timeout => 5) # Time less than implicit
@wait.until {@driver.find_element(:tag_name => "body").text.include?("hey")}
Run Code Online (Sandbox Code Playgroud)
这现在为驱动程序提供了30秒的搜索时间(不是预期的)
有没有办法让硒等待explicit等待时间而不是两者中的较大者?
注意 - 不是声明隐式等待时间不是一个选项,因为每次驱动程序无法找到某些内容时我都无法让selenium挂起.
使用Selenium版本30,windows,ff