Running Please ...">

Image of click_link in a cucumber

<a href="/videos/21-running">
  <img height="120" src="/images/sample-image.jpg" alt="Running">
</a>

Please support me by clicking on the cucumber click alt or src. Thank.

+3
source share
1 answer

Assuming you use capybaracucumber to support your specs, something like the next step should do the trick.

When /^I follow image link "([^"]*)"$/ do |img_alt|
    find(:xpath, "//img[@alt = '#{img_alt}']/parent::a").click()
end

In the spec you can just say

When I follow image link "Running"

The general idea is that this requires some kind of custom step.

+9
source

Source: https://habr.com/ru/post/1769089/


All Articles