public class UIRow0jqxGrid1Pane : HtmlDiv
{
public UIRow0jqxGrid1Pane(UITestControl searchLimitContainer) :
base(searchLimitContainer)
{
#region Search Criteria
this.SearchProperties[HtmlDiv.PropertyNames.Id] = "row0jqxGrid1";//This ID will be dynamic. Need to search based on provided InnerText
this.SearchProperties[HtmlDiv.PropertyNames.Name] = null;
this.FilterProperties[HtmlDiv.PropertyNames.InnerText] = "XXXX";
this.FilterProperties[HtmlDiv.PropertyNames.Title] = null;
this.FilterProperties[HtmlDiv.PropertyNames.Class] = null;
this.FilterProperties[HtmlDiv.PropertyNames.ControlDefinition] = "id=\"row0jqxGrid1\" role=\"row\" style=\"height: 25px; ;\"";
this.FilterProperties[HtmlDiv.PropertyNames.TagInstance] = "696";
this.WindowTitles.Add("Test");
#endregion
}
#region Properties
public HtmlDiv UIALMONDESTATECONSULTAPane
{
get
{
if ((this.mUIALMONDESTATECONSULTAPane == null))
{
this.mUIALMONDESTATECONSULTAPane = new HtmlDiv(this);
#region Search Criteria
this.mUIALMONDESTATECONSULTAPane.SearchProperties[HtmlDiv.PropertyNames.Id] = null;
this.mUIALMONDESTATECONSULTAPane.SearchProperties[HtmlDiv.PropertyNames.Name] = null;
this.mUIALMONDESTATECONSULTAPane.FilterProperties[HtmlDiv.PropertyNames.InnerText] = "XXXX";
this.mUIALMONDESTATECONSULTAPane.FilterProperties[HtmlDiv.PropertyNames.Title] = null;
this.mUIALMONDESTATECONSULTAPane.FilterProperties[HtmlDiv.PropertyNames.Class] = null;
this.mUIALMONDESTATECONSULTAPane.FilterProperties[HtmlDiv.PropertyNames.ControlDefinition] = "style=\"text-align: left; padding-bottom: 2px; margin- " +
"margin-right: 2px; margin- -ms-text-\"";
this.mUIALMONDESTATECONSULTAPane.FilterProperties[HtmlDiv.PropertyNames.TagInstance] = "700";
this.mUIALMONDESTATECONSULTAPane.WindowTitles.Add("Test;
#endregion
}
return this.mUIALMONDESTATECONSULTAPane;
}
}
#endregion
#region Fields
private HtmlDiv mUIALMONDESTATECONSULTAPane;
#endregion
}
場景____上面的代碼是從網格中選擇一個項目時生成的。我注意到物品在網格中被標識爲「窗格」。現在針對不同的場景,我必須選擇不同的項目。我所有的輸入值都存儲在一個文件中,我從中獲取一個值並傳遞給測試方法。如何根據搜索到的內文/名稱知道控件ID
我想要什麼____我需要根據我提供的值找到網格的行ID,以便在該行上發生鼠標點擊。
我做了什麼____網格填充數據從數據庫中檢索。所以我不能認爲哪個值會有什麼行ID。我已經改變了InnerText SearchProperty,但隨後回放停止並且測試失敗。
我在HTML ____The HTML結構注意到這是什麼
<grid id="grid1" style="....">
<div>Header Row definition</div>
<div> Data Row
<div id="gridRow0" style="...">A</div>
<div id="gridRow1" style="...">B</div>
<div id="gridRow2" style="...">C</div>
<div id="gridRow3" style="...">D</div>
.......
......
</div>
</grid>
請給一些解決方案...我沒有找到任何線索......
感謝您的時間...
你可以迭代網格中的所有行,並且cmopare到提供的值 - 當找到匹配時將其作爲控件傳遞給mouse.Click(control)方法。以獲得控制使用網格控件上的GetChildren()方法 – barakcaf