根据下拉列表中的选择,下表标题更改意味着订单/位置发生变化。
以下代码仅在表标题为静态时有效。标题顺序更改时如何选择/单击特定记录?
public void productFilter(By tableLocator, By rowLocator, String openDate, String product, String status)
{
IWebElement tableElement = DriverManager.driver.FindElement(tableLocator);
IList<IWebElement> trElements = DriverManager.driver.FindElements(rowLocator);
int rowCount = trElements.Count;
for (int i = 0; i < rowCount; i++)
{
IList<IWebElement> tdElements = trElements[i].FindElements(By.TagName("td"));
int j = 2;
if (tdElements[j].Text == openDate && j < tdElements.Count)
{
j++;
if (tdElements[j].Text == product)
{
j++;
if (tdElements[j].Text == status)
{
i = i + 1;
WaitforElementToBeClickable(By.XPath("//table/tbody/tr[" + i + "]/td[" + j + "]//a"));
IWebElement dataElement = DriverManager.driver.FindElement(By.XPath("//table/tbody/tr[" + i + "]/td[" + j + "]//a"));
JavaScriptEleClick(dataElement);
break;
}
}
}
}
}
暂无答案!
目前还没有任何答案,快来回答吧!