else42.de
else42.de

Reputation: 535

Get all current forms via code

I can identify (find) an element with a certain RanoreXPath via Ranorex Spy, but not via Ranorex API. Is there a method to output all current \forms on the computer to be able to debug the problem?

Upvotes: 0

Views: 635

Answers (2)

RanorexPro
RanorexPro

Reputation: 36

var FormElementList = Host.Local.Find("/form");

foreach (var formElement in FormElementList) {
    Report.Info(formElement.GetPath(PathBuildMode.Default, Ranorex.Host.Local).ToString());
}

Upvotes: 1

Sup3rHugh
Sup3rHugh

Reputation: 677

By identify, do you really mean find?

When I encouter problems with troubleshooting an issue, I usually insert Report.Screenshot and Report.Snapshot at strategic places in recordings (or user code).

When Report.Screenshot has no element specified, it captures a screenshot of the entire desktop which can be useful (when tests are executed unattended). Report.Snapshot does however need an element (/form could be used as suggested by RanorexPro), but if your XPath is incorrect, this won't help much...

Hoping this gives you ideas...

Upvotes: 0

Related Questions