为对象库元素建立一组Adapter

如果一个对象库中的元素的RanoreXPath对应界面上的多个元素,你可以使用CreateAdapters方法来建立一组adapter .

 C#

// Create a list of adapters using the “Info” object
IList<Ranorex.Button> buttonList =
repo.MyApp.EnabledButtonsInfo.CreateAdapters<Ranorex.Button>();

// Move the mouse pointer to each button of the list
// and add a screenshot for each to the report
foreach (Ranorex.Button button in buttonList )
{
button.MoveTo();
Report.Screenshot(button);
}

VB.NET

‘ Create a list of adapters using the “Info” object
Dim buttonList As IList(Of Ranorex.Button) =
repo.MyApp.EnabledButtonsInfo.CreateAdapters(Of Ranorex.Button)()

‘ Move the mouse pointer to each button of the list
‘ and add a screenshot for each to the report
For Each button As Ranorex.Button In buttonList
button.MoveTo()
Report.Screenshot(button)
Next

了解更多关于如何让一个对象库中的项对应多个元素:为多个元素指定同一个对象库项

Leave a comment

请输入正确的验证码