Ok, So I came across a strange issue clicking on this drop down in watir.
but I don't get the same thing using watir-webdriver.

I can click the button and it should open the drop down(list) and I should
be able to click on one of the items in that list. but when watir fires the
click i see it clicking but it does not open the drop down(list)
watir-webdriver fires the click opens the dropdown and allows me to select
the item in the list i want. any suggestions?

So here is the code on the page <http://www.etsy.com/>.

<form action="http://www.etsy.com/search.php"; id="search-bar" class="">
                <div class="" style="-moz-user-select: none; cursor:
default;" id="search-facet" tabindex="0" aria-haspopup="true">
                    <label for="search-query">Handmade</label>
                    <iframe style="display: none; width: 178px;
height: 170px;" src="javascript:false;" id="search-facet-shim"
tabindex="-1" longdesc="Decorative" title="" frameborder="0"></iframe>
                    <ul id="search-facet-list" class="closed" tabindex="0">
                                            <li class="handmade
selected">Handmade</li>
                                            <li class="vintage">Vintage</li>
                                            <li class="supplies">Supplies</li>
                                            <li class="all">All Items</li>
                                            <li class="people">People</li>
                                            <li class="shops">Shops</li>
                                        </ul>
                </div>
                <div class="input-group">
                    <input autocomplete="off" value=""
name="search_query" id="search-query" class="text" tabindex="0"
type="text"><div style="top: 42px; left: 0px; width: 369px; display:
none;" id="search-suggestions"></div>
                    <button id="search_submit" name="search_submit"
type="submit">
                        Search
                    </button>
                </div>
                <input value="handmade" name="search_type"
id="search-type" type="hidden">
</form>

now you would think that a simple.

b.label(:for => 'search-query').click
b.li(:text => 'Supplies').click



but it doesn't at least not with watir, watir-webdriver on the other hand
works just fine

#chrome:
irb
ruby-1.8.7-p334 :001 > require 'rubygems'
 => true
ruby-1.8.7-p334 :002 > require 'watir-webdriver'
 => true
ruby-1.8.7-p334 :003 > b = Watir::Browser.new :chrome
 => #<Watir::Browser:0x101a9ebb8 url="about:blank" title="about:blank">
ruby-1.8.7-p334 :004 > b.goto 'http://www.etsy.com
ruby-1.8.7-p334 :005'> => "http://www.etsy.com/";
ruby-1.8.7-p334 :006 > b.label(:for => 'search-query').html
 => "<label for=\"search-query\">Handmade</label>"
ruby-1.8.7-p334 :007 > b.label(:for => 'search-query').click
 => []
ruby-1.8.7-p334 :008 > b.li(:text => 'Supplies').html
 => "<li class=\"supplies\">Supplies</li>"
ruby-1.8.7-p334 :009 > b.label(:for => 'search-query').click
 => []
ruby-1.8.7-p334 :010 > b.li(:text => 'Supplies').click
 => []

and with firefox

#firefox
irb
ruby-1.8.7-p334 :001 > require 'rubygems'
 => true
ruby-1.8.7-p334 :002 > require 'watir-webdriver'
 => true
ruby-1.8.7-p334 :003 > b = Watir::Browser.new :ff
 => #<Watir::Browser:0x101a9ec08 url="about:blank" title="">
ruby-1.8.7-p334 :004 > b.goto "http://www.etsy.com";
 => "http://www.etsy.com/";
ruby-1.8.7-p334 :005 > b.label(:for => 'search-query').click
 => []
ruby-1.8.7-p334 :006 > b.li(:text => 'Supplies').click
 => []
ruby-1.8.7-p334 :007 > b.close
 => true
ruby-1.8.7-p334 :008 >


Thanks
Oscar
http://www.thechort.com/blog/

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

Reply via email to