I'm testing the GUI on my application with Selenium 2.0.
The suggestbox apprears when i type data into an input field, and i need to click on the suggestbox to validate the input.
Image here : Image
My html code (input) :
<table class="supplier" cellspacing="1" width="100%">
<tbody>
<tr>
<td><span id="supplier:supplierOps" class="ui-autocomplete">
<input id="supplier:supplierOps_input" name="supplier:supplierOps_input" type="text" class="ui-autocomplete-input ui-inputfield ui-widget ui-state-default ui-corner-all" autocomplete="off" value="" size="10" role="textbox" aria-disabled="false" aria-readonly="false" aria-multiline="false">
</span></td>
<td>...</td>
</tr>
</tbody>
</table>
My html code (suggestBox) :
<table class="ui-autocomplete-items ui-autocomplete-table ui-widget-content ui-widget ui-corner-all ui-helper-reset">
<tbody>
<tr class="ui-autocomplete-item ui-autocomplete-row ui-corner-all ui-state-highlight" data-item-value="1" data-item-label="OPS1">
<td>OPS1 - Supplier1</td>
</tr>
</tbody>
</table>
My selenium code :
// supplier ops, i find and type data into the input
WebElement eSupplier = driver.findElement(By.id("supplier:supplierOps_input"));
eSupplier.sendKeys("OPS1");
sleep(5); // wait the suggestbox
// i find the suggestbox
WebElement eSupplierSuggest = driver.findElement(By.xpath("//div[@id='supplier:supplierOps_panel']/table/tbody/tr"));
eSupplierSuggest.click();
sleep(5); // wait the refresh for the next field supplierAddress
My xpath and everything seems ok.
So, the question is : What element ( td, tr, table, ...) i need to catch/select and what method (driver.click(), sendKeys(), ...) do i need to use to validate the suggestBox?
EDIT :
The suggestbox hasn't the focus when it appreas to validate. So i'm searching to set the focus on it and try a sendKeys(Keys_ENTER). Set focus on WebElement?
EDIT2 :
Some news guys, I'm going to try to solve it with Arquillian Graphene. It's a framework that enforces tester to write Ajax-enabled and reusable tests and test abstractions,
Links : Introduction to Graphene - Graphene 2.0.0.Alpha3 Released - JBoss Community Graphene2 - Jquery Selector