"http://www.google.com").click 我们可以-6ren">
gpt4 book ai didi

ruby - 如何在 Watir 中指定 'Or' 条件元素说明符?

转载 作者:太空宇宙 更新时间:2023-11-03 16:56:19 26 4
gpt4 key购买 nike

我们可以在 Watir 中指定一个“And”说明符,例如

ie.link(:innertext=>"google",:href=>"http://www.google.com").click

我们可以指定一个“或”说明符吗?喜欢

ie.link(:innertext=>"google"||:href=>"http://www.google.com").click

最佳答案

if browser(:text => "google").exist?
browser(:text => "google").click
elsif browser(:href => /google/).exist?
browser(:href => /google/).click
end

关于ruby - 如何在 Watir 中指定 'Or' 条件元素说明符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8550144/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com