[英]Watir-Webdriver - Checking for enabled linke
I am having trouble checking if a link is enabled for automation testing. 我无法检查是否为自动化测试启用了链接。
I have the following code but it throws an error: 我有以下代码,但会引发错误:
if @browser.link(:xpath,'//*[@id="aBreakDown"]/div[3]/div[1]/div/a').enabled?
print_red("User can import a new activity")
else
print_green("User cannot import a new activity")
end
I get the following error: 我收到以下错误:
undefined method `enabled?'
未定义的方法“启用?” for # (NoMetho dError)
为#(NoMetho dError)
Is there a way around this?? 有没有解决的办法??
ok, let's try someth about: 好的,让我们尝试一下:
if @browser.link(:xpath,'//*[@id="aBreakDown"]/div[3]/div[1]/div/a').attribute_value("ng-disabled") == "job.IsLocked"
print_green("User cannot import a new activity")
else
print_red("User can import a new activity")
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.