CapyBara Click Link Different Cases and Solutions

Learning with Earning

To click generic link whom text is not multiple times used:

click_link "Help"

To click generic link whom text is multiple times used:
Like show, destroy, edit links on your index page


first(:link, 'Show').click
first(:link, link_name).click

Click Link with id


 all('a').select {|elt| elt.text == "#tag1" }.first.click

OR
Which of the links do you want to click on? If it’s the first (or it doesn’t matter), you can do


find('#tag1').click
Otherwise you can do

all('#tag1')[1].click
to click the second one.

If  you have, nested html and link lies in




 


first('.item').click_link('Agree')

View original post

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s