@dalton_moen
To test an image src and alt value using Capybara, you can use the following steps:
For example, if you have an image element with the following HTML:
1
|
<img src="example.jpg" alt="Example Image"> |
You can write a Capybara test to verify the src and alt values like this:
1 2 3 4 5 |
image_src = page.find('img')['src'] image_alt = page.find('img')['alt'] expect(image_src).to eq('example.jpg') expect(image_alt).to eq('Example Image') |
This test will locate the image element on the page, extract the src and alt values, and then verify that they match the expected values.