Adding User Code Collection to Library

Best practices, code snippets for common functionality, examples, and guidelines.
Posts: 1
Joined: Tue Aug 30, 2016 11:42 pm

Adding User Code Collection to Library

Post by msmith » Wed Jan 31, 2018 1:41 am

My user created methods don't show up in the library when selecting User Code -> Select From Library

I've added Automation Helpers to my solution and see them showing when selecting User code as a new action.
I also added my own User Code Collection by following the "Collections and Methods" from the help, but when selecting User Code -> Select From Library, my methods don't show up

I've tried a few things including re-building the solution

Any steps I'm missing?


Re: Adding User Code Collection to Library

Post by Vega » Wed Jan 31, 2018 10:14 pm

How did you create these methods? Did you create them from the action table like Add new action --> User code method --> New user code method? It is partial guesswork without actually seeing your solution, unfortunately. Would you be able to show a screenshot by chance? I know your solution probably has sensitive info, so if that is the case would you be able to create a small sample solution which shows the same issue? That way you can show us what is going on without exposing sensitive data.

Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: Adding User Code Collection to Library

Post by krstcs » Wed Jan 31, 2018 10:30 pm

If you can't share your actual solution, you could create a small demo solution and share that. Just create the User Code methods the way you normally would, but leave them empty (or just put Report.Info methods in them) and name them with generic names.

As Vega said, it is very hard for us to help without seeing your solution, so a demo solution is the next best thing.
Shortcuts usually aren't...

Posts: 32
Joined: Tue Jan 06, 2015 7:22 am

Re: Adding User Code Collection to Library

Post by Shakib » Mon Mar 26, 2018 10:04 am

1. right click to user code collection
2. select 'insert new user code method".
3. make it public static.
4. save it.
5. go to the recording module.
6. click on add new action.
7. select use code
8. user defined methods will display

Posts: 4
Joined: Thu Feb 10, 2022 2:03 pm

Re: Adding User Code Collection to Library

Post by michael.wowro » Sat Jul 30, 2022 3:04 pm

Very old thread, but Google brought me here because I had the same problem.

My solution: The type of argument I used (Ranorex.WebElement) was not protested by Ranorex Studio in any way, but was still not allowed for User Code Methods (see: ... darguments). After changing the type to Ranorex.Adapter, my new User Code Method was also displayed here: New Action -> User Code -> Select From Library.