ok I found a example ..may b that can help you.According to that
script looks like this...

require 'rubygems'
require 'Watir'
#Watir::Browser
require 'win32ole'
Watir::Browser.default = 'firefox'
$IE = Watir::Browser.new
            $IE.goto("http://www.earnlikes.com/fans";)
                        sleep 5
            $IE.text_field(:id, 'pageurl').set('www.facebook.com/
aneeskAclickography')
            ## Image HTML: <IMG onclick=facebookLikes(1); alt=""
src="http://www.earnlikes.com/templates/images/btn_submiturl.gif";>
                        sleep 12
            $IE.image(:index, 5).click
                        sleep 12
=============================================

#$IE.span(:text, "Like").click
or
#levelone_dropdown = 'Like'
                        
#$IE.element_by_xpath("//div[2]/table/tbody/tr/td/div/div/a/
span[contains(text(),'#{levelone_dropdown}')]").click
I have tried above both but not working..
=============================================


On Feb 20, 5:12 pm, Mohit <sukhija...@gmail.com> wrote:
> I Have also tried. but still no luck using xpath. This xpath i copied using
> friebug and seems to be good.
>
> levelone_dropdown = 'Hello'
> $IE.element_by_xpath("//div[2]/table/tbody/tr/td/div/div/a/span[contains(text(),'#{levelone_dropdown}')]").click
>
> the full path is as copied using firebug:
> /html/body/div[2]/table/tbody/tr/td/div/div/a/span
>
> "hello" is inside this span.. I hope this makes you clear hiow to proceed by
> xpath
>
>
>
> On Sun, Feb 20, 2011 at 4:17 PM, Mohit <sukhija...@gmail.com> wrote:
> > the xpath i found for hello is
> > /html/body/div[2]/table/tbody/tr/td/div/div/a/span
>
> > but not able to click
>
> > ie.link(:xpath,"/html/body/div[2]/table/tbody/tr/td/div/div/a/span/hello").click
>
> > On Thu, Feb 17, 2011 at 9:20 PM, sdemian <sergeydemjanc...@gmail.com>wrote:
>
> >> I am really confused by your new code also it is seriously differ from
> >> previous one and i could not find span with hello text in it, cuz the
> >> main
> >> idea was to locate span element on the page as i understand.
> >> Still recommend to use xpath for element location, probably HttpWatch
> >> is
> >> handy to use here.
>
> >> On Feb 17, 5:02 pm, mike_sukhi <sukhija...@gmail.com> wrote:
> >> > the code now of a div is in which "hello" is not showing but it seems
> >> > to "hello-button-11" is the real button and hello is a image..i
> >> > guess :)
>
> >> >           <div class="time">
> >> >                 <div id="hello-button-11" class="linkbtn">
> >> >                   <fb:hello font="arial" width="100"
> >> > show_faces="false" layout="button_count" href="http://www.abc.com/
> >> > elitegudz" class=" fb_edge_widget_with_comment
> >> > fb_iframe_widget"><span><iframe scrolling="no" id="f545a8562f2a38"
> >> > name="f2cdf57ef4ea374" style="border: medium none; overflow: hidden;
> >> > height: 20px; width: 100px;" title="Like this content on Facebook."
> >> > class="fb_ltr" src="http://www.abc.com/
>
> >> plug;layout=button_count&amp;locale=en_US&amp;node_type=link&amp;sdk=joey&amp;show_faces=false&amp;width=100"></
> >> > iframe></span></fb:like>
> >> >                 </div>
> >> >                 <div align="left" class="americaair">Gudz<br>
> >> >                   <b> <a target="_blank" href="http://www.abc.com/";>
> >>http://www.abc.com/</a> <a target="_blank" href="http://www.abc.com/";><img
> >> src="http://www.time.com/templates/images/
> >> > icon.gif"></a> </b> </div>
> >> >                 <!--<div class="icon"></div>-->
> >> >               </div>
>
> >> > On Feb 17, 6:37 pm, Сергей Демьянчук <sergeydemjanc...@gmail.com>
> >> > wrote:
>
> >> > > Try this code to see available properties for spans on the page :
>
> >> > > ie.spans.each do |span|
> >> > > span.flash
> >> > > span.to_s
> >> > > end
>
> >> > > Also this code works for me:
>
> >> > > ie.span(:text, 'Hello').flash
>
> >> > > If those spans are in the frame you possibly will need additional code
> >> to
> >> > > use.
>
> >> > > I suggest to use xpath to locate elements with same properties.
> >> > > What effect do you want to achieve clicking on the span ?
>
> >> > > 2011/2/17 mike_sukhi <sukhija...@gmail.com>
>
> >> > > > The code is:
>
> >> > > > <td class="connect_widget_vertical_center
> >> > > > connect_widget_button_cell"><div class="connect_button_slider"><div
> >> > > > class="connect_button_container"><a
> >> class="connect_widget_text_button
> >> > > > clearfix time_button_no_time"><span class="time">Hello</span></a></
> >> > > > div></div></td>
>
> >> > > > ####Hello appears 10 times on the page..with same code:
> >> > > > I have tried with the following option but no success.
>
> >> > > > $IE.span(:class =>'time', :text =>'Hello').click
> >> > > > or
> >> > > > $IE.span(:class =>'time', :index=>7).click
>
> >> > > > still no sucess ...
>
> >> > > > --
> >> > > > Before posting, please readhttp://watir.com/support. In short:
> >> search
> >> > > > before you ask, be nice.
>
> >> > > > watir-general@googlegroups.com
> >> > > >http://groups.google.com/group/watir-general
> >> > > > watir-general+unsubscr...@googlegroups.com<
> >>http://groups.google.com/group/watir-general%0Awatir-general+unsubscr...>
>
> >> --
> >> Before posting, please readhttp://watir.com/support. In short: search
> >> before you ask, be nice.
>
> >> watir-general@googlegroups.com
> >>http://groups.google.com/group/watir-general
> >> watir-general+unsubscr...@googlegroups.com<http://groups.google.com/group/watir-general%0Awatir-general+unsubscr...>
>
> > --
>
> > *
>
> --
>
Regards ,
Mohit

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

Reply via email to