Thanks a lot for this post. I spent a hell lot of time figuring why this 
problem was occurring.

On Sunday, 13 May 2012 18:34:17 UTC+5:30, Jarmo Pertman wrote:
>
> If id exists more than once then it should be fixed by that website 
> developers, since it is invalid html.
>
> The html you provided seems to be invalid too, since i can't see where 
> it's class attribute value has ending quote. But you can use index for 
> these cases:
> $ie.div(:class => /x-combo/, :index => 1) #for second element if you're 
> using newer Watir with 0-based-indexing.
>
> Jarmo
>
> On Saturday, May 12, 2012 10:16:39 PM UTC+3, Bhavesh wrote:
>>
>> Hi, 
>>
>> I have html code for my application where same DIV class and id for an 
>> particular element is appearing twice. 
>>
>> or say in 2 places. 
>>
>> <DIV class=x-combo-list-item _nodup="30811" viewIndex="5">Files_Raj</ 
>> DIV> 
>>
>> <DIV class=x-combo-list-item _nodup="30811" viewIndex="5">Files_Raj</ 
>> DIV> 
>>
>> These are appearing twice, and having same class and index. 
>>
>> I have to select the last DIV not the first. 
>>
>> How can i acheive this. 
>>
>> I tried like this : 
>>
>> $_ = $ie.html 
>> $b = $ie.html.scan(/<DIV class=(x-combo-list-item) _nodup="\S*" 
>> viewIndex=\"\S*\">#{subfolders}<\/DIV>/).flatten 
>> rowid = $b[-1].to_s 
>> $ie.div(:class => rowid , :index => 5).click 
>>
>>
>> But not successfull. it is not clicking the desired element as well as 
>> not showing any error. 
>>
>> Can anyone know? 
>>
>> Bhavesh
>
>

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