我正在使用 selenium webdriver 并尝试让页面对象在报告测试失败之前多次查看页面。我的问题是我遇到了一个错误,我的开始救援块没有捕获到该错误。
这是错误
Selenium::WebDriver::Error::NoSuchElementError: 无法定位元素:{"method":"id","selector":"does not exist"}
class ManageMembers < Nav
def initialize
super
ready = false # Used to indicate if all elements expected are present
tryCount = 0# A counter to track the number of attempts to
while(ready == false)
puts "initalizing managemembers"
#things on the side menue
begin
$driver.find_element(:id, "does not exist")
$driver.find_element(:id, "sidebar")
$driver.find_element(:id, "sidebar").find_element(:link, "Manage Members")
$driver.find_element(:id, "sidebar").find_element(:link, "Create Member")
@sidebar = true
rescue @sidebar = false
end