How do I test an image alt value using capybara?
Posted
by stayce
on Stack Overflow
See other posts from Stack Overflow
or by stayce
Published on 2010-05-14T22:48:02Z
Indexed on
2010/05/14
22:54 UTC
Read the original article
Hit count: 403
I'm trying to define a step to test the value of alt text of an image using capybara and the css selectors.
I wrote one for input values based on the readme examples:
Then /^I should see a value of "([^\"])" within the "([^\"])" input$/ do |input_value, input_id| element_value = locate("input##{input_id}").value element_value.should == input_value end
But I can't figure this one out...something like:
Then /^I should see the alttext "([^\"]*)"$/ do | alt_text | element_value = locate("img[alt]").value
Anyone know how I can locate the alt text value?
© Stack Overflow or respective owner