word On Tue, Oct 2, 2012 at 12:53 PM, Jarmo Pertman <[email protected]> wrote:
> Or even > result.click if result > > But i would drop the #find call also and use just Watir API: > result = @browser.table(:index, 3).link(:text => link_name) > result.click if result.exists? > > Jarmo Pertman > ----- > IT does really matter - http://itreallymatters.net > > > On Tuesday, October 2, 2012 6:47:30 AM UTC+3, Oscar.Rieken wrote: > >> http://railstips.org/blog/**archives/2008/12/01/unless-** >> the-abused-ruby-conditional/<http://railstips.org/blog/archives/2008/12/01/unless-the-abused-ruby-conditional/> >> >> if result >> result.click >> end >> >> >> On Mon, Oct 1, 2012 at 3:57 PM, John Fitisoff <[email protected]> wrote: >> >>> Here's another way that might work: >>> >>> #This should return either an object or nil >>> result = @browser.table(:index, 3).links.find {|tr| tr.text == link_name} >>> result.click unless result.nil? >>> >>> >>> >>> ------------------------------ >>> *From:* Joe Fl <[email protected]> >>> *To:* [email protected] >>> *Sent:* Monday, October 1, 2012 11:16 AM >>> *Subject:* [wtr-general] Using ternary operator with Watir >>> >>> Hi everyone, >>> >>> I am experimenting with the ruby and I would like to know if I could >>> include a 'break' in the loop below once the link >>> is clicked. >>> >>> I have tried a couple of ideas but they just ended in a syntax error. >>> >>> @browser.table(:index,3).**links.each{|tr| puts tr.text == link_name ? >>> (@browser.a(:text,tr.text).**click) : (puts "Not fiond")} >>> >>> Any help would be greatly appreciated. >>> >>> Thank you, >>> Joe >>> -- >>> Before posting, please read http://watir.com/support. In short: search >>> before you ask, be nice. >>> >>> [email protected] >>> http://groups.google.com/**group/watir-general<http://groups.google.com/group/watir-general> >>> watir-genera...@**googlegroups.com >>> >>> >>> -- >>> Before posting, please read http://watir.com/support. In short: search >>> before you ask, be nice. >>> >>> [email protected] >>> http://groups.google.com/**group/watir-general<http://groups.google.com/group/watir-general> >>> watir-genera...@**googlegroups.com >>> >> >> -- > Before posting, please read http://watir.com/support. In short: search > before you ask, be nice. > > [email protected] > http://groups.google.com/group/watir-general > [email protected] > -- Before posting, please read http://watir.com/support. In short: search before you ask, be nice. [email protected] http://groups.google.com/group/watir-general [email protected]
