Finally, I find the reason-----Host.Local.Find() suspend

Ask general questions here.
marcushe
Posts: 112
Joined: Tue Apr 14, 2009 6:38 am

Finally, I find the reason-----Host.Local.Find() suspend

Post by marcushe » Mon Dec 14, 2009 9:45 am

In last topic ,i said my program will hang when executing Host.Local.Find(new rxpath"/form[@processname='IKernel' and @class='#32770']")
It make me headache. Then i tried,tried,tried. Then i find the real peacebreaker-------------------
Testing Environment: XP US SP3,Ranorex
Source Code:
IList<ranorex.RadioButton> rbs=new List<Ranorex.RadioButton>();
Ilist<Ranorex.Button> bss=new List<Ranorex.Button>();
//Start->Control Panel->Add or Remove Program
Ilist<Element> allApp=Host.Local.Find(new rxpath("/form[@title='Add or Remove Program]/container/listitem[@accessiblename='Access Help']"));
Delay.Seconds(2);
//Here ,you unstall a program manually, it may ask you to confirm, just let it be, don't click the OK/Cancel
//The processname is IKernel will be easy to reproduce the problem
string s="/form[@processname='IKernel' and @visible='true' and @enabled='true']";
IList<Element> ls=new List<Element>();
do
{
ls=Host.Local.Find(new RxPath(s));
rbs=ls[0].AS<Ranorex.Form>().FindDescendants<Ranorex.RadioButton>();
bss=ls[0].AS<Ranorex.Form>().FindDescendants<Ranorex.Button>();
Delay.Seconds(2);
} while (1==1);


Then ,if you try more, step by step ,it can suspend at rbs or bss . Funny.....
if i use "form[@title='Add or Remove Program]/container" ,it will not suspend, however ,i must use the items beneath the container.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: Finally, I find the reason-----Host.Local.Find() suspend

Post by Support Team » Tue Dec 15, 2009 11:31 am

I was able to reproduce your problem at last. I found an application uninstaller which exhibits this behavior.
It seems that the "Add Remove Programs" dialog somehow blocks its message pump which has a weird effect on the uninstaller dialog.

This only happens when you use MSAA (Accessible) elements in the "Add Remove" dialog.
Unfortunately, we cannot offer a simple solution because this is not a Ranorex-specific problem. Possible workarounds could include:

1) Start the uninstaller directly instead from the Add/Remove Programs dialog
2) Start two independent test executables, one which starts the uninstaller, and the second which continues working with the uninstall dialog
3) Instead of accessing the items in the Add/Remove dialog use image-based search on the *form*, or simple relative coordinates

I hope this is any help.

Michael
Ranorex Team
.
Image

marcushe
Posts: 112
Joined: Tue Apr 14, 2009 6:38 am

Re: Finally, I find the reason-----Host.Local.Find() suspend

Post by marcushe » Wed Dec 16, 2009 3:06 am

Thanks,my friends.

I'm glad it is proved. I'll try your advices and thank you very much.

We choose the 2nd solution,it's working!!