Page 1 of 1

Desktop application error

Posted: Wed Aug 08, 2018 9:32 pm
by kumprave5
I am trying to convert recording (Please see screenshot) into below mentioned code module
void ITestModule.Run()
{

Host.Local.RunApplication(@"C:\org\application\NETComponents\random.exe");
Ranorex.Delay.Milliseconds(10000);
Ranorex.Control ctrl = Ranorex.Control.FromPath("/form[@controlname='Flash' or @domain='localhost']//flexobject[@movie='C:\\org\\web\\webapps\\abc.swf']");
Ranorex.Text t = ctrl.FindSingle("?/?/text[@id='userInput']");
t.TextValue.Equals("inputvalue");

}
My Code launches the application but doesn't input text and throws error "The element does not support the required capability 'control'. ";

Re: Desktop application error

Posted: Fri Aug 10, 2018 11:00 am
by RobinHood42
Hi,
Ranorex.Control ctrl = Ranorex.Control.FromPath("/form[@controlname='Flash' or @domain='localhost']//flexobject[@movie='C:\\org\\web\\webapps\\abc.swf']");
You can't cast a flex object to a Ranorex.Control.

Please use the following code instead:
Ranorex.FlexObject ctrl = Ranorex.Control.FromPath("/form[@controlname='Flash' or @domain='localhost']//flexobject[@movie='C:\\org\\web\\webapps\\abc.swf']");
Cheers,
Robin :mrgreen:

Re: Desktop application error

Posted: Fri Aug 10, 2018 1:58 pm
by kumprave5
Hi RobinHood42

Sorry to say, but this is not working for me. It throws exception "Explicitly Ranorex.Control can't cast to Ranorex.Flexobject" so I just changed this line
to Ranorex.FlexObject ctrl =Ranorex.FlexObject.FromPath("same rxpath thing here");

I found an article provided by Ranorex but did not make any sense to me. https://www.ranorex.com/help/latest/int ... pplication. Please go through this if it makes sense to you.

I believe there is some problem in /form[@controlname='Flash' or @domain='localhost'] and //flexobject[@movie='C:\\org\\web\\webapps\\abc.swf']
I think I need to place these files somewhere else according to the article provided by Ranorex. .

Re: Desktop application error

Posted: Mon Aug 13, 2018 8:40 am
by RobinHood42
Hi,

I would recommend to simply track the wanted element with Ranorex Spy. Afterwards, simply drag/drop the element to your Ranorex Studio CodeModule. The code to the element gets auto-created.

Cheers,
Robin