Passing object from object repository to user code methods

Ranorex Spy, Recorder, and Studio.
hanen.fredj
Posts: 2
Joined: Mon Jul 29, 2019 4:52 pm

Passing object from object repository to user code methods

Post by hanen.fredj » Mon Jul 29, 2019 4:58 pm

Hello,
I need to create a new method to set text in a text field and a second one to select an item from a list.
For both methods I have to set the object(text field or the list) and the value (to type or to select) as parameters.
Could you tell me how is it possible to pass the objects from the object repository to the user code please?
Thank you.

User avatar
Vega
Posts: 166
Joined: Mon Jul 11, 2016 2:15 pm

Re: Passing object from object repository to user code methods

Post by Vega » Tue Jul 30, 2019 8:37 pm

You can right click -> view code to see how Ranorex does it as your basis. I just made a click action on the explorer and then right click -> view code:

Code: Select all

 public void Mouse_Click_Explorer(RepoItemInfo menubarInfo)
        {
            Report.Log(ReportLevel.Info, "Mouse", "Mouse Left Click item 'menubarInfo' at Center.", menubarInfo);
            menubarInfo.FindAdapter<MenuBar>().Click();
        }
You can also make a reference to the repository:
farm1.png
farm1.png (36.42 KiB) Viewed 86 times
Hope this helps