Selenium Webdriver / Ruby:断言超时
Selenium Webdriver / Ruby : assert times out
我有这一行,它正在点击一个下拉菜单并断言存在一个列表选项。如果列表项不存在,我想输出文本“列表项不存在”,但它最终会一直等待并最终完全超时。
assert{ displayed?(:xpath, "//li[text() = 'Clinical Review Feedback Type']") }
感谢您的帮助。
我想也许我明白了:
begin
@driver.find_element(:xpath, "//*[text() = 'Clinical Review Feedback Type']").click
rescue => e
p e.message
puts "Filter not found in list"
end
如果要打印 "list item not present",则应在代码中应用异常处理。这样,如果您的元素不存在,那么 catch 块会在控制台
中打印消息
现在可以使用了 - 感谢大家为我指明了正确的方向。
begin
@driver.find_element(:xpath, "//*[text() = 'Clinical Review Feedback Type']").click
rescue => e
p e.message
puts "Filter not found in list"
end
我有这一行,它正在点击一个下拉菜单并断言存在一个列表选项。如果列表项不存在,我想输出文本“列表项不存在”,但它最终会一直等待并最终完全超时。
assert{ displayed?(:xpath, "//li[text() = 'Clinical Review Feedback Type']") }
感谢您的帮助。
我想也许我明白了:
begin
@driver.find_element(:xpath, "//*[text() = 'Clinical Review Feedback Type']").click
rescue => e
p e.message
puts "Filter not found in list"
end
如果要打印 "list item not present",则应在代码中应用异常处理。这样,如果您的元素不存在,那么 catch 块会在控制台
中打印消息现在可以使用了 - 感谢大家为我指明了正确的方向。
begin
@driver.find_element(:xpath, "//*[text() = 'Clinical Review Feedback Type']").click
rescue => e
p e.message
puts "Filter not found in list"
end