????Ranorex???????????????????????????????????????????е?ranorex??????????????(???? Ranorex.Validate????????????????Ч????????)??????????????????????Ranorex???????????????????????????????????????????????????????Ranorex????
????C#
????Ranorex.Cell cellObject = null; // Try to find a cell object using two // different RanoreXPath expressions bool found=false; found = Host.Local.TryFindSingle<Ranorex.Cell>("/form//table/row/cell[3]"?? 2000?? out cellObject); found = Host.Local.TryFindSingle<Ranorex.Cell>("/form//table/row/cell[4]"?? 2000?? out cellObject); // If none of the expressions returns an object // throw new 'ElementNotFoundException' and test case fails if (!found) { throw new Ranorex.ElementNotFoundException("Both RanoreXPath with no return"?? null); } else { // If the value of attribute 'Text' does not equal to the expected value // throw new 'ValidationException' to break the test case if ( cellObject.Text == "MyExpectedTextValue" ) { Report.Success("User Specific Validation"??"Text validation of cell object succeeded"); } else { throw new Ranorex.ValidationException("Text validation of cell object succeeded failed"); } }
????VB.NET
????Dim cellObject As Ranorex.Cell = Nothing ' Try to find a cell object using two ' different RanoreXPath expressions Dim found As Boolean = Host.Local.TryFindSingle(Of Ranorex.Cell)("/form//table/row/cell[3]"?? 2000?? cellObject) found = Host.Local.TryFindSingle(Of Ranorex.Cell)("/form//table/row/cell[4]"?? 2000?? cellObject) ' If none of the expressions returns an object ' throw new 'ElementNotFoundException' and test case fails If Not found Then Throw New Ranorex.ElementNotFoundException("Both RanoreXPath with no return"?? Nothing) Else ' If the value of attribute 'Text' does not equal to the expected value ' throw new 'ValidationException' to break the test case If cellObject.Text = "MyExpectedTextValue" Then Report.Success("User Specific Validation"?? "Text validation of cell object succeeded") Else Throw New Ranorex.ValidationException("Text validation of cell object succeeded failed") End If End If