I am trying to select an item in a combo-list with text "1 : 272988" where the combo list is defined as a list of div tags all with the same class name as below:
<div style="width: 108px; height: 300px;" id="ext-gen334" class="x- combo-list-inner">
<div class="x-combo-list-item">1 : 1066</div>
<div class="x-combo-list-item">1 : 2132</div>
<div class="x-combo-list-item">1 : 4265</div>
<div class="x-combo-list-item x-combo-selected">1 : 8530</div>
<div class="x-combo-list-item">1 : 17061</div>
<div class="x-combo-list-item">1 : 34123</div>
<div class="x-combo-list-item">1 : 68247</div>
<div class="x-combo-list-item">1 : 136494</div>
<div class="x-combo-list-item">1 : 272988</div>
<div class="x-combo-list-item">1 : 545977</div>
I have tried the following options below but all result in a watir unknown object exception error
@browser.div(:class => "x-combo-list-inner", :text => "1 :272988").click
@browser.div(:class => "x-combo-list-inner").div(:class => "x-combo-list-item", :text => "1 : 272988").click
@browser.div(:class => "x-combo-list-inner").div(:class => "x-combo-list-item", :index => 8)
@browser.div(:class => "x-combo-list-inner").div(:text => "1 : 272988").click
For all the above I have also tried substituting
.click
with
.wait_until_present
and get watir timeout exception errors. I have also tried performing a
.exists?
for all the above options and they return false.
The results would suggest that the combo list items don't actually exist however when I check the containing div elements that hold the combo list items as below
puts @browser.div(:class => "x-combo-list-inner").div(:class => "x-combo-list-item").exists?
a true value returned.
Would greatly appreciate any other ideas as I have run out.
@browser.div(:class => "x-combo-list-inner")
returns the first match. My guess is that it is not the first one that has this specific list. What do you get if you output@browser.divs(:class => "x-combo-list-inner").length
– Justin Ko@browser.divs(:class => "x-combo-list-inner")[1].div(:class => "x-combo-list-item", :text => "1 : 272988").click
and it worked! – Costa