Hi Derek!
Thank you so much. This works just run it:

b.element(:xpath => "//span[@name='header2']").click

I just thought that maybe a simple way and not to use the entire full path.




<div id="mceu_41" class="mce-container mce-panel mce-floatpanel mce-menu
mce-menu-align" role="application" tabindex="-1" hidefocus="1"
style="border-width: 1px; z-index: 65535; left: 33px; top: 206.433px;
width: 1391px; display: none;">

    <div id="mceu_41-body" class="mce-container-body mce-stack-layout"
role="menu" style="width: 1391px;">
        <div id="mceu_42" class="mce-menu-item mce-menu-item-normal
mce-first mce-stack-layout-item" tabindex="-1" role="menuitem"
aria-checked="false" aria-pressed="false"></div>
        <div id="mceu_43" class="mce-menu-item mce-menu-item-normal
mce-stack-layout-item mce-active" tabindex="-1" role="menuitem"
aria-checked="true" aria-pressed="true">
            <i class="mce-ico mce-i-none"></i>
            <span id="mceu_43-text" class="mce-text"
style="font-family:serif;font-size:24px;font-weight:700;font-style:…ransparent;border:;border-radius:;outline:;text-shadow:none;"
name="header2">

                Header 2

            </span>
        </div>
        <div id="mceu_44" class="mce-menu-item mce-menu-item-normal
mce-stack-layout-item" tabindex="-1" role="menuitem" aria-checked="false"
aria-pressed="false"></div>
        <div id="mceu_45" class="mce-menu-item mce-menu-item-normal
mce-stack-layout-item" tabindex="-1" role="menuitem" aria-checked="false"
aria-pressed="false"></div>
        <div id="mceu_46" class="mce-menu-item mce-menu-item-normal
mce-stack-layout-item" tabindex="-1" role="menuitem" aria-checked="false"
aria-pressed="false"></div>





On Mon, Oct 20, 2014 at 4:18 PM, Derek W <[email protected]> wrote:

> What is the reason you don't want to use xpath?  If it's just because of
> the length/cryptic names used, is it possible that this would work for the
> xpath:
> //span[@name='header2']
>
> If not, what about the text or other properties within that span?  Can you
> take a screenshot of the span node expanded?
>
> On Mon, Oct 20, 2014 at 1:06 PM, c w <[email protected]> wrote:
>
>> 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.
>>
>
>
>
> --
> Derek Wrobel
> 425-243-3355
>
> --
> --
> 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.

Reply via email to