私のシナリオでは、Web テーブルからすべてのデータを取得し、それを配列に格納しています。各配列には、1 つの行データが保持されます。
ここでの問題は、反復ごとに新しい名前で新しい配列を作成したいということです。最初の行のデータが 1 つの配列に格納されるようにします。2 行目のデータがフェッチされると、新しい配列が作成され、新しく作成された配列にデータが格納される必要があります。
私は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++;
}
}