how to make sure a link is clicked with watir-rails -


i using watir perform functions

i need show link clicked watir-driver, i'm trying put somthing console if link clicked follow:

puts "profile clicked" if click_my_profile_link(browser) 

and:

 def self.click_my_profile_link(browser)     browser.div(class: "topbar").when_present       .link(class: 'my-profile').click   end 

but nothing gets printed console when link gets clicked. behaviour same everywhere have click action. example is:

puts "next button clicked" if browser.input(id: 'next', value: 'next').fire_event :click 

how can kind of log when there click action fired this? thanks

procedural methods called action/side-effect , shouldn't expected have response.

if didn't error, watir found element , sent click command it.

so maybe sufficient expect {click_my_profile_link(browser)}.to_not raise_error

typically write tests verify result of link. in case expect(browser.title == "my profile title").to true

you create afterhook take additional action after every navigation , click, wouldn't distinguish between two, , don't think want.


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -