我正在尝试获取所有失败的列表。即,如果找不到任何一个,则捕获错误消息id
。Follwoing 是水豚自动化脚本。
在以下代码中,异常处理工作正常!
puts "Verifying Home Page"
def verifyHomepage(id, successMsg, errorMsg)
begin
page.find(id)
puts successMsg
rescue
puts errorMsg
end
end
verifyHomepage("#logoAnchor", "logo anchor found", "Logo anchor not Found")
verifyHomepage(".navbar-inner", "Header Bar found", "Header Bar not Found")
verifyHomepage(".unstyled", "All Occasions Frame found", "All Occasions Frame not Found")
verifyHomepage("##easyPrintPromoBox", "Easy Print Frame", "Easy Print Frame not Found")
verifyHomepage(".tabbable", "l3 Tabs Featured Occasions/Pairings/ArtistEasy Print Frame", "3 Tabs Featured Occasions/Pairings/ArtistEasy Print Frame Not found")
verifyHomepage("##givingCardPromoBox", "Create the perfect gift found", "Create the perfect gift not Found")
verifyHomepage(".footerr", "Footer Frame found", "Footer Frame found not Found")
这里我使用不同的值重复调用verifyHomePage
方法 7 次。param
如何将 3params
作为array
值而不是值传递。string
我的意思是例如:
verifyHomepage(idArray[],successMsg[],errorMsg[])