I am given a RepoItemInfo object, and would like to retrieve the corresponding adapter from my repository.

RepoItemInfo.FindAdapter<T> finds or creates and adapter of type T, however my code is supposed to be general and should not assume a particular type. Instead, I would like to retrieve the adapter specified in my repository as denoted by RepoItemInfo.FullName.

3 Answers 3


I have found a solution via reflection.

public static class RanorexExtensions

    /// <summary>
    /// Creates an adapter for the associated repository item
    /// as defined in the repository.
    /// If you know the adapter type, or want to use a different
    /// one, you can use <see cref="FindAdapter{T}" /> instead.
    /// </summary>
    /// <param name="itemInfo">The RepoItemInfo object</param>
    /// <returns>The adapter.</returns>
    public static Adapter GetAdapter(this RepoItemInfo itemInfo)
        var folder = itemInfo.ParentFolder;
        Adapter adapter = (Adapter)folder.GetType().GetProperty(itemInfo.Name).GetValue(folder);
        return adapter;
  • Hi! This solution has some disadvantages. In some cases .GetValue(folder) causes TIMEOUT
    – hellboy
    Commented Jun 5, 2018 at 10:37
  • Hi @hellboy sorry to hear. Worked fine for us. Is it reproducible? Can you conclude a certain pattern/common aspect of those that timeout and those that do not? Commented Sep 5, 2018 at 13:57

you can do


if it is just for something like click

  • 2
    Could you explain a bit what the true parameter does? Thanks. Could I also use this approach if I do not now the type WebElement beforehand? Commented Aug 21, 2019 at 13:57

Use simply this;

repoItemInfo.FindAdapter<Unknown>().Element.SetAttributeValue("Text", Value);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.