| View previous topic :: View next topic |
| Author |
Message |
grahama
Joined: 24 Apr 2007 Posts: 8
|
Posted: Thu Jun 14, 2007 8:07 pm Post subject: Cannot read items in a listbox |
|
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: click into code to enlarge
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: click into code to enlarge
Ranorex.ListBox lb = new ListBox(c.Handle);
But again, lb.Text is an empty string.
I even tried using the element:
Code: click into code to enlarge
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 |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Fri Jun 15, 2007 12:25 am Post subject: |
|
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 |
|
| Back to top |
|
 |
grahama
Joined: 24 Apr 2007 Posts: 8
|
Posted: Fri Jun 15, 2007 9:22 pm Post subject: |
|
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 |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Sun Jun 17, 2007 9:05 pm Post subject: |
|
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 |
|
| Back to top |
|
 |
grahama
Joined: 24 Apr 2007 Posts: 8
|
Posted: Mon Jun 25, 2007 3:05 am Post subject: |
|
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.
 |
|
| Back to top |
|
 |
saurabh
Joined: 20 Jul 2007 Posts: 20 Location: India
|
Posted: Fri Jul 20, 2007 2:22 pm Post subject: |
|
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,Strin g*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;
} |
|
| Back to top |
|
 |
|