在我的场景中,我从 web 表中获取所有数据并将其存储在一个数组中。每个数组保存一行数据。
我的问题是,我想为每次迭代创建一个具有新名称的新数组。以便第一行中的数据存储在一个数组中。获取第二行数据时,应创建一个新数组,并将数据存储在新创建的数组中。
我正在使用 c# 语言。
这是我的代码
IWebElement table = _Browser.FindElementById("", "gview_jqGrid");
IList<IWebElement> rowCollections = table.FindElements(By.TagName("tr"));
int RowCnt = rowCollections.Count;
String[] DataArray = new String[RowCnt];
foreach (IWebElement row in rowCollections)
{
IList<IWebElement> colCollection = row.FindElements(By.TagName("td"));
foreach (IWebElement col in colCollection)
{
String Data = col.Text;
// ------ Here I want a array to store data. A new array for each Iteration
j++;
}
}