Using the xpath works: b.element(:xpath => "//div[@id='mceu_41']/div[@id='mceu_41-body']/div[@id='mceu_43']/span[@name='header2']").click
but I don't want to use the xpath. On Mon, Oct 20, 2014 at 3:13 PM, c w <[email protected]> wrote: > Hi, > > please can one advise me on what I am doing wrong. > > I try to click on any header elements[I want to select one for instance]. > I have asked the dev to add for me name= “header2” for instance for span > > But it looks like it doesn’t work. Can we click spans using the name? > > This is a screen snapshot: > > > https://s3.amazonaws.com/uploads.hipchat.com/54839/774688/efrYkROYGYSqfk6/upload.png > > This is the quick source code: > > require 'watir-webdriver' > b = Watir::Browser.new > > b.goto " > http://dev-next-app01.vfmltech.com/cube/dms-angular/src/public/vizlly/#/components > " > sleep 1 > d = b.driver > d.switch_to.frame "uiTinymce0_ifr" > > d.switch_to.active_element.send_keys [:control, "a"], :backspace > d.switch_to.active_element.click > d.switch_to.active_element.send_keys("Hello Testing RTE is > fun.................!") > sleep 6 > > #----------------------------------------------------------------------------- > # click editor's 'bullist' button > d.switch_to.active_element.send_keys [:control, "a"] > b.button(:name => 'format').click > sleep 6 > > > b.span(:name => 'header2').click > > I have try using index as well. > > > #b.span(:index , 2).click > -- -- 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.
