Custom Action by Inheritance

Ranorex Spy, Recorder, and Studio.
narmand
Posts: 13
Joined: Thu Mar 21, 2013 11:20 pm

Custom Action by Inheritance

Post by narmand » Tue Jun 16, 2015 6:45 pm

I followed the steps on this url (http://www.ranorex.com/blog/custom-smart-actions) to link a class to my recording module. When i initially followed the steps it didnt work, I tried on another sample project and it worked, so I decided to try again on my "real" and this time it didnt work. Work as in I could not view the methods on the recording module when I added a user code item to the script. The drop down was empty.

This is what I did:
1) Project, create a C# class
2) pasted my method to the class
3) open the <RecordingName>.UserCode.cs file and add a colon followed by the name of the base class to the existing declaration of the class
4) Added a recording module
5) insert a user code, nothing appears in the drop down
6) created a new recording module and nothing happens
What is the proper sequence ? Do i need to create the recording module first?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3921
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Custom Action by Inheritance

Post by odklizec » Wed Jun 17, 2015 7:17 am

Hi,

Do you have, by any chance, the class file stored in a folder? In this case, the class name must be preceded with that folder name!
ClassInheritance.png
ClassInheritance.png (56.61 KiB) Viewed 932 times
What happens, if you start typing after the colon? Do you see the class name in IntelliSense popup screen?
Pavel Kudrys
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

alexpayne
Posts: 1
Joined: Mon Oct 10, 2016 7:48 pm

Re: Custom Action by Inheritance

Post by alexpayne » Wed Oct 19, 2016 9:33 pm

I know this thread is a year old, but I ran in to the exact same problem and thought I could offer some insight for anyone coming after me.
In my case, the issue was that one of the parameters had the type Ranorex.Element. I changed it to Ranorex.Adapter and it worked.

I guess there are some object types that Ranorex won't let you use for parameters.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 3921
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Custom Action by Inheritance

Post by odklizec » Fri Oct 21, 2016 9:21 am

If you want to pass a repo element to custom method, it must be declared either as "repoiteminfo" (Ranorex.Core.Repository.RepoItemInfo) or "adapter" (Ranorex.Adapter).
Pavel Kudrys
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