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 <[email protected]> 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 <[email protected]>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 <[email protected]> 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&locale=en_US&node_type=link&sdk=joey&show_faces=false&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, Сергей Демьянчук <[email protected]>
>> > 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 <[email protected]>
>> >
>> > > > 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.
>> >
>> > > > [email protected]
>> > > >http://groups.google.com/group/watir-general
>> > > > [email protected]<
>> http://groups.google.com/group/watir-general%0Awatir-general+unsubscr...>
>>
>> --
>> 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]<http://groups.google.com/group/watir-general%[email protected]>
>>
>
>
>
> --
> *Thanks and Regards,
> Mohit Sukhija
> +91-9645190180
> *
>
--
*Thanks and Regards,
Mohit Sukhija
+91-9645190180
*
--
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]