No, result is the same - autosuggestions hided. No search.

irb(main):104:0> browser.tr(:class => 'gac_a', :index=> 2).click
=> []

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


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

> Click on the table row instead, and use the :index attribute
>
> e.g.
>
> 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> wrote:
>
>> Hi!
>>  I'm study using of Watir at Ruby. At main page ( 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";)
>>> 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. In short: search
>> before you ask, be nice.
>>
>> watir-general@googlegroups.com
>> http://groups.google.com/group/watir-general
>> 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
>

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