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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

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