Hi,
im trying to find a particular element under a form based on the forminfo(on a windows desktop applicaiton). A similar element is present in 2 forms and based on the input forminfo find the element under that form and click on it.
But the findsingle / find descendant method gives me error, please help.
FormName Rxpath eg:-
Form1 .//form[@controlname~'frmGanttChart']
element1 element[@controlname='atbpRibbon']//element[@controlname='agbGanttChart']
element2 element[@controlname='atbpRibbon']//element[@controlname='agbTileVertical']
element3 element[@controlname='atbpRibbon']//element[@controlname='agbFindBar']
im trying to find the agbFindBar element under different forms based on forminfo.
var AgbFindBar= formInfo.FindAdapter<Form>().FindSingle<Element>("@controlname='agbFindBar'");
var AgbFindBar= formInfo.FindAdapter<Form>().FindDescendant<Element>("agbFindBar");
AgbFindBar.Click();
the reason im
Find element under a form
Re: Find element under a form
Hi,
Please upload a Ranorex snapshot (not screenshot) for mentioned element/form and the exact error you are getting! Without snapshot and error message, we can only guess what's the problem.
Please upload a Ranorex snapshot (not screenshot) for mentioned element/form and the exact error you are getting! Without snapshot and error message, we can only guess what's the problem.
Pavel Kudrys
Ranorex explorer at Descartes Systems
Please add these details to your questions:
Ranorex explorer at Descartes Systems
Please add these details to your questions:
- Ranorex Snapshot. Learn how to create one >here<
- Ranorex xPath of problematic element(s)
- Ranorex version
- OS version
- HW configuration
Re: Find element under a form
Error message :-
The type 'Ranorex.Core.Element' cannot be used as type parameter 'T' in the generic type or method 'Ranorex.Adapter.FindDescendant<T>(string)'. There is no implicit reference conversion from 'Ranorex.Core.Element' to 'Ranorex.Adapter'.
The type 'Ranorex.Core.Element' cannot be used as type parameter 'T' in the generic type or method 'Ranorex.Adapter.FindDescendant<T>(string)'. There is no implicit reference conversion from 'Ranorex.Core.Element' to 'Ranorex.Adapter'.
- Attachments
-
- agbFindBar1.rxsnp
- (100.75 KiB) Downloaded 36 times
-
- Posts: 254
- Joined: Tue Mar 24, 2015 5:05 pm
- Location: Des Moines, Iowa, USA
Re: Find element under a form
If you haven't, it could be helpful to review some background on Ranorex Adapters. The elements are in the Ranorex namespace NOT under Ranorex.Core.rajeswari wrote:Error message :-
The type 'Ranorex.Core.Element' cannot be used as type parameter 'T' in the generic type or method 'Ranorex.Adapter.FindDescendant<T>(string)'. There is no implicit reference conversion from 'Ranorex.Core.Element' to 'Ranorex.Adapter'.
If your app is a Win32 application, you can try NativeItem or NativeWindow. If all else fails you should be able to use Unknown
Doug Vaughan
Re: Find element under a form
Hi Vaughan,
Thanks for the suggestion, i'm using Unknown and it works fine.
.
formInfo.FindAdapter<Form>().FindDescendant<Ranorex.Unknown>("agbFindBar").Click();
Thanks
Raj
Thanks for the suggestion, i'm using Unknown and it works fine.

formInfo.FindAdapter<Form>().FindDescendant<Ranorex.Unknown>("agbFindBar").Click();
Thanks
Raj
-
- Posts: 254
- Joined: Tue Mar 24, 2015 5:05 pm
- Location: Des Moines, Iowa, USA
Re: Find element under a form
I am glad to hear that. Just keep in mind "Unknown" is extremely generic, so you may get additional/better functionality if you find a better fit.rajeswari wrote:Hi Vaughan,
Thanks for the suggestion, i'm using Unknown and it works fine..
formInfo.FindAdapter<Form>().FindDescendant<Ranorex.Unknown>("agbFindBar").Click();
Thanks
Raj
Doug Vaughan