---------- Forwarded message ----------
From: Vitaliy Smok <4sm...@gmail.com>
Date: 2011/4/11
Subject: Re: [wtr-general] How to 'click' row from table returned by
AJAX-helper at google.com?
To: Tim Koopmans <tim.ko...@gmail.com>


Hi!
 It's a bit strange thing. And looks like some sort of bug.

 At home i have FireFox 4 - i'm starting 'interactive Ruby' and just paste
to it follow commands:

require "rubygems"
> require "watir-webdriver"
> browser = Watir::Browser.new(:firefox)
> browser.goto("http://www.google.com";)
> browser.text_field(:name => "q").set "1"
> browser.tr(:class => 'gac_a', :index=> 2).click
>

When i set '1' - there appear autosuggestions, but when i try to click (
browser.tr(:class => 'gac_a', :index=> 2).click ) it just disappears and
there remain '1' at search string and no auto-suggestion.
Now at other machine i had install FireFox 3.6.16. The *same* *works *there
like charm.

But at FF3 there's other problem:

> require "rubygems"
> require "watir-webdriver"
>
> browser = Watir::Browser.new(:firefox)
> browser.goto("http://www.google.com";)
> browser.text_field(:name => "q").set "Hello World!"
> browser.button(:name => "btnG").click  OR  browser.button(:class =>
> "lsb").click OR browser.button(:index => 1).click
>

This code at the end must get search by keywords "Hello World!". Right? But
it somewhy searches by 'hello world php'  ^__^
By FireFox4 it searches exactly 'Hello World!'.
i found that "browser.button(:index => 2).click" does search with keywords
'Hello World!'.



2011/4/10 Tim Koopmans <tim.ko...@gmail.com>

> Don't know. Works for me. Please articulate what is the problem exactly?
>
> Regards,
> Tim
>
> Sent from my mobile ...
>
>
> On 10/04/2011, at 7:24 AM, Vitaliy Smok <4sm...@gmail.com> wrote:
>
> No, result is the same - autosuggestions hided. No search.
>
> irb(main):104:0> <http://browser.tr>browser.tr(:class => 'gac_a', :index=>
> 2).click
> => []
>
> require "rubygems"
> require "watir-webdriver"
>
> browser = Watir::Browser.new(:firefox)
> browser.goto(" <http://www.google.com>http://www.google.com";)
> browser.text_field(:name => "q").set "1"
> <http://browser.tr>browser.tr(:class => 'gac_a', :index=> 2).click
>
>
> 2011/4/10 Tim Koopmans < <tim.ko...@gmail.com>tim.ko...@gmail.com>
>
>> Click on the table row instead, and use the :index attribute
>>
>> e.g.
>>
>> <http://browser.tr>browser.tr(:class => 'gac_a', :index=> 2).click
>>
>> will click the third row of the auto suggestions ...
>>
>>
>>
>> On Sat, Apr 9, 2011 at 6:40 PM, Vitaliy Smok < <4sm...@gmail.com>
>> 4sm...@gmail.com> wrote:
>>
>>> Hi!
>>>  I'm study using of Watir at Ruby. At main page (
>>> <http://www.google.com>www.google.com ) when you entering something
>>> AJAX-helper gives you 10 variants of search queries, and you can click at
>>> any of them to get immediately search results. That helper is just table and
>>> you can access its elements by browser.table(:class => 'gac_m')[X]. For
>>> example, text of element::
>>> > browser.table(:class => 'gac_m')[3].text
>>> => "1 \320\272\320\262\321\226\321\202\320\275\321\217"
>>>
>>> Here example how I'm doing now:
>>>
>>>> require "rubygems"
>>>> require "watir-webdriver"
>>>>
>>>> browser = Watir::Browser.new(:firefox)
>>>> browser.goto(" <http://www.google.com>http://www.google.com";)
>>>> browser.text_field(:name => "q").set "1"
>>>> browser.text_field(:name => "q").set browser.table(:class =>
>>>> 'gac_m')[3].text
>>>> browser.button(:name => "btnG").click
>>>>
>>>
>>>
>>>
>>> But I'm wondering how i can "click" it from Watir to simulate real user
>>> actions:
>>>
>>> irb(main):182:0> browser.table(:class => 'gac_m')[3].click
>>> => []
>>>
>>> and nothing happens, so I'm doing something wrong, may you advice?
>>>
>>>
>>> system: Ruby1.87&WindowsXP&FireFox 4
>>>
>>> --
>>> Before posting, please read <http://watir.com/support>
>>> http://watir.com/support. In short: search before you ask, be nice.
>>>
>>>  <watir-general@googlegroups.com>watir-general@googlegroups.com
>>>  <http://groups.google.com/group/watir-general>
>>> http://groups.google.com/group/watir-general
>>>  <watir-general%2bunsubscr...@googlegroups.com>
>>> watir-general+unsubscr...@googlegroups.com
>>>
>>
>>  --
>> Before posting, please read <http://watir.com/support>
>> http://watir.com/support. In short: search before you ask, be nice.
>>
>>  <watir-general@googlegroups.com>watir-general@googlegroups.com
>>  <http://groups.google.com/group/watir-general>
>> http://groups.google.com/group/watir-general
>>  <watir-general%2bunsubscr...@googlegroups.com>
>> watir-general+unsubscr...@googlegroups.com
>>
>
>

-- 
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