如何使用 C# 比较 Ranorex 中的文本?我想比较来自网站的文本。在这种情况下,我们必须比较文本。
问问题
2485 次
2 回答
0
the easiest way is to use the innertext property on the element from the website. So for instance use the xpath to find the element, get the innertext property and compare that text in c# the same way you would compare any other string
于 2014-10-17T15:23:06.597 回答
0
指定字符串的正确验证形式:
string validationHasToMatch = "Test data";
将元素添加到包含比较所需文本的存储库。让我们调用 repo 对象:
repo.DomObject.textElement;
围绕它们建立验证:
if (repo.DomObject.TextElement.InnerText == validationHasToMatch)
{
Report.Success("Texts match!");
} else {
Report.Failure("Texts don't match!");
}
这只是一个简单的示例,也是在其上构建更多功能的基础。
于 2015-11-02T09:21:34.793 回答