Desktop application error

Ask general questions here.
kumprave5
Posts: 33
Joined: Wed Jul 18, 2018 9:55 pm

Desktop application error

Post by kumprave5 » Wed Aug 08, 2018 9:32 pm

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'. ";
Attachments
Recording.PNG
Recording.PNG (17.75 KiB) Viewed 158 times

User avatar
RobinHood42
Posts: 239
Joined: Fri Jan 09, 2015 3:24 pm

Re: Desktop application error

Post by RobinHood42 » Fri Aug 10, 2018 11:00 am

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:

kumprave5
Posts: 33
Joined: Wed Jul 18, 2018 9:55 pm

Re: Desktop application error

Post by kumprave5 » Fri Aug 10, 2018 1:58 pm

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. .

User avatar
RobinHood42
Posts: 239
Joined: Fri Jan 09, 2015 3:24 pm

Re: Desktop application error

Post by RobinHood42 » Mon Aug 13, 2018 8:40 am

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