Method: Capybara::Node::Actions#click_link

Defined in:
lib/capybara/node/actions.rb

Finds a link by id or text and clicks it. Also looks at image alt text inside the link.

Parameters:

  • locator (String)

    Text, id or text of link



25
26
27
28
# File 'lib/capybara/node/actions.rb', line 25

def click_link(locator)
  msg = "no link with title, id or text '#{locator}' found"
  find(:xpath, XPath::HTML.link(locator), :message => msg).click
end