Hi Anne,

what Keith said.

The methods with the plural form (lis, images, divs etc.) return an
array of elements and you cannot click on an array.

You need to find a specific element and then click on it as Keith
suggested with the li method in this case.
Alternatively you can use the plural form and then narrow the search
down later on, for example

browser.lis.first.click (if you wanted to click on the first item)

Br.
Marko

On Apr 6, 10:49 pm, Anne <annemordk...@gmail.com> wrote:
> I've been doing automation for a while but am new to Ruby/Watir.  I'm
> trying to access the first item in an unordered list and everything I
> try returns an Argument Error ("wrong number of arguments (2 for
> 0)").  I've been hitting my head against a wall for a day now and just
> can't seem to get it.  Can you please help?
>
> the html looks like this:
>
> <div id="searchResults">
>    <div id="priorities">
>    <div id="resultList">
>           <ul>
>           <li>
>                 <a id="abc/123" class"searchResult
> searchResultPreviewed" href="/mystuff/my-topic"> My Topic Title
>                  </a>
>             </li>
>            +<li>
>            +<li>
>             </ul>
>
> I'm trying to click on the first <li> item (which is one of many).
> I've tried:
>    browser.lis(:id, "abc/123").click
>    browser.lis(:xpath, "//a[id='abc/123']/").click
>    browser.lis(:text, "My Topic Title").click
> I also tried all these with .select instead of .click
>
> each time I've gotten
> ArgumentError: wrong number of arguments (2 for 0)
>
> I know I'm missing something basic.  Can you point me in the right
> direction?
>
> Thanks!
> Anne

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