Hi,
Ranorex is an xpath-based TA tool and therefore, its API heavily rely on xpaths. To find an element using
automationid attribute, you can use something like this...
Code: Select all
Host.Local.FindSingle("//*[@automationid='idstring']");
or in variabilized form...
Code: Select all
Host.Local.FindSingle("//*[@automationid='" + varId + "']");
I would personally recommend using Ranorex repository and search the elements via code only if there is absolutely no way to use repo. And even then, you should use repo elements as starting points and search elements from given repo element e.g. like this:
Code: Select all
public static void SearchAnElement(RepoItemInfo repoElementLBL)
{
if (repoElementLBL.Exists(10000))
{
var foundElement = repoElementLBL.CreateAdapter<Ranorex.Unknown>(false).FindSingle("//*[@automationid='idstring'");
...
}
}