Hi and thank you! I found the way:
@browser.button(:value => 'View Details', :index => 0).click works great. On Thu, Mar 13, 2014 at 1:58 PM, c w <[email protected]> wrote: > Thank you! > > The question is when we go here http://puppies.herokuapp.com > > how can we click in an easy way on the View Detail button for Hanna? or > any View Detail button as we do not have an id. > > Kind Regards, > Cristina > > > On Thu, Mar 13, 2014 at 6:03 AM, Oscar Rieken <[email protected]> wrote: > >> when you are using watir you almost never have to use xpath. you didnt >> post any html so its kind of hard to give you a simpler way to locate >> without using xpath. but I would probably try to break out just the >> container and then locate the button inside of it. >> >> >> On Wed, Mar 12, 2014 at 5:20 PM, c w <[email protected]> wrote: >> >>> Hi, >>> >>> I am using the following and works. >>> However my question is if there simple way to define these xpaths? >>> >>> >>> When /^I click the first View Details button$/ do >>> @browser.button(:xpath, >>> "/html/body/div[@id='container']/div[@id='wrapper']/div[@id='content']/div[@class='puppy_list'][1]/div[@class='list_line_odd']/div[@class='view']/form[@class='button_to']/div/input[@class='rounded_button']").click() >>> end >>> >>> When /^I click the second View Details button$/ do >>> @browser.button(:xpath, >>> "/html/body/div[@id='container']/div[@id='wrapper']/div[@id='content']/div[@class='puppy_list'][2]/div[@class='list_line_even']/div[@class='view']/form[@class='button_to']/div/input[@class='rounded_button']").click() >>> >>> end >>> >>> >>> Kind Regards, >>> Cristina >>> >>> -- >>> -- >>> 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] >>> >>> --- >>> You received this message because you are subscribed to the Google >>> Groups "Watir General" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> -- >> 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] >> >> --- >> You received this message because you are subscribed to the Google Groups >> "Watir General" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > -- -- 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] --- You received this message because you are subscribed to the Google Groups "Watir General" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
