Find elements of a dropdown list: RFT/Rational Functional Tester


To display all elements of a drop down list on the console, following code may be used:
Find out the id/name property of the required drop down list and replace the same in line 2.
Also remember, if name property is used, do not forget to replace “.id” by “.name”.

RootTestObject root1 = getRootTestObject();

TestObject[] to = root1.find(atDescendant(“.class”, “Html.SELECT”, “.id”, “Id_Of_List_Or_Dropdown”));

System.out.println(to[0].getClass());

SelectGuiSubitemTestObject object_for_select = ((SelectGuiSubitemTestObject) to[0]);

ITestDataList dataList = (ITestDataList)object_for_select.getTestData(“list”);

ITestDataElementList elementList = (ITestDataElementList)dataList.getElements();

for(int i = 0; i

{

 This statement prints the Items of the Listbox or combo box.

         System.out.println(“Item Index  “+i+” “+elementList.getElement(i).getElement().toString());

}

1 thought on “Find elements of a dropdown list: RFT/Rational Functional Tester”

Leave a Comment