compare two values in ranorex

2019-07-31 10:20发布

We are using Ranorex 5.02 We need to compare values (numbers) in website UI and generated pdf file these values always are the same. Each time the system will generate new values for UI and pdf file. We need to check that the new generated values are correct. Adding validation methods not really help because the system recorded actual number and after running test script again validation is failed. We tried to create variables in validations the system displays unbounded variable message.

Any help is greatly appreciated.

1条回答
够拽才男人
2楼-- · 2019-07-31 11:04

You can use the "Get Value" action in order to store the values into a variable. After that you can compare the values using the "Equals" method from the String class in .NET.

enter image description here

 public void CompareText(string webText, string pdfText)
    {
        if(webText.Equals(pdfText))
        {
            Report.Info("Text is equal!");
        }
        else
        {
            Report.Info("Text is NOT equal!");
        }
    }
查看更多
登录 后发表回答