webElement
中有315 allElement
。我必须在我的数据库表上保存9个元素。我怎么能这样做?
我试过了
for (var i = 0; i<=find; i++)
{
IList<IWebElement> allElement = driver.FindElements(By.XPath("//table[@class='TableText1'][2]/tbody/tr/td[contains(@class, 'Table_List') or contains(@class, 'Table_List_diff')]"));
for (int j = 0; j < allElement.Count; j=j+9)
{
var list1 = allElement.Take(j+9).ToArray();
try
{
var text = new access_event_logs();
text.USERID = list1[0].Text;
text.DEPARTMENT = list1[3].Text;
text.LOCAL_TIMESTAMP = Convert.ToDateTime(list1[4].Text);
text.EVENTID = list1[5].Text;
text.TERMINALSN = list1[6].Text;
text.PhotoPath = list1[7].Text;
text.REMARKS = list1[8].Text;
text.ACCESSMETHOD = "fp";
text.TERMINALIP = "09898";
text.PHOTO = null;
text.PHOTOSIZE = 0;
text.RECLOGFROMIP = "";
db.access_event_logs.Add(text);
db.SaveChanges();
}
}
我只能保存前9个元素[0]到[8] ..如何保存所有315元素? 我有个主意。首先保存9个元素,然后从列表中删除这些元素。但我无法做到这一点。