ruby on rails - capybara assert attributes of an element -


i'm using rspec2 , capybara acceptance testing.

i assert link disabled or not in capybara. how can this?

how disabling link? class you're adding? attribute?

# check link has "disabled" class: page.should have_css("a.my_link.disabled") page.should have_xpath("//a[@class='disabled']")  # check link has "disabled" attribute: page.should have_css("a.my_link[disabled]") page.should have_xpath("//a[@class='disabled' , @disabled='disabled']")  # check element visible find("a.my_link").should be_visible find(:xpath, "//a[@class='disabled']").should be_visible 

the actual xpath selectors may incorrect. don't use xpath often!


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -