简体   繁体   中英

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)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM