Page 1 of 1

Cannot read items in a listbox

Posted: Thu Jun 14, 2007 7:07 pm
by grahama
I am unable to read the entries in a listbox.

The app being tested uses what I believe are 3rd-party controls. In particular, a list box control uses the class name "ClaList_X" (where X is some hex value).

I can find the control using

Code: Select all

Control c = parent.FindControlId(id);
where id was found using RanorexSpy. But c.Text is an empty string.

I tried building a ListBox object:

Code: Select all

Ranorex.ListBox lb = new ListBox(c.Handle);
But again, lb.Text is an empty string.

I even tried using the element:

Code: Select all

Element e = c.Element;
Both e.Text and e.Name are empty strings. Searching through the child elements (and their children, and their children down about six levels) yielded nothing.

I've run out of ideas .. any suggestions?

Graham

Posted: Thu Jun 14, 2007 11:25 pm
by webops
Does RanorexSpy see the elements of the 3rd-party listbox?
(Please use the newest version from http://www.ranorex.com/products/spy.html).

If yes, what are the role and names of the elements?

Jenö
Ranorex Team

Posted: Fri Jun 15, 2007 8:22 pm
by grahama
To clarify - the control is actually a custom ListView, not ListBox (my mistake). But the original post still applies - I cannot see any items or subitems.

I tried out RanorexSpy, and it canNOT see any of the rows in the listview (or even the column headers) as seperate elements. It always gives the same values no matter where in the control the mouse is.

Graham

Posted: Sun Jun 17, 2007 8:05 pm
by webops
Can you please post us the name and manufacturer of the control.
I think it doesn't support accessibility, we should ask the company for the suggested way.

Jenö
Ranorex Team

Posted: Mon Jun 25, 2007 2:05 am
by grahama
Unfortunately, we do not know the vendor who created the control - we are testing a 3rd party application without access to source.

I suspect that their design of the control has "hidden" this information.

But no worries - we found a workaround that makes it unnecessary to retrieive this information.

:D

Posted: Fri Jul 20, 2007 1:22 pm
by saurabh
Find this code i think it will be helpful as direct control is not working for list box
here form hold the handler of main application like cal.exe
String* DispListBoxTest(String*DispCompVal,String*DispCompName,Form*form,String*szStatus)
{
ListBox* lCtrl = form->FindListBox(DispCompVal);
if(lCtrl==0){
Console::WriteLine(S"Displayer Test List {0} not found",DispCompName);
szStatus = "Fail";
}
Mouse::MoveToControl(lCtrl);
lCtrl->Focus();
String* Listtext = lCtrl->SelectedText;
int itemcount = lCtrl->ItemCount;
for (int i=0; i < itemcount;i++){
String* Listtext = lCtrl->GetItemText(i);
Element *element = lCtrl->get_Element();//need more input to generalized
Element *listItem =element->FindChild(Ranorex::Role::ListItem, Listtext, NULL);
Mouse::ClickElement(listItem);
Console::WriteLine(S"Displayer Test Case {0} Execution success",
Listtext);
szStatus = "Pass";
//break;
}
return szStatus;
}