I am new to both C# and selenium.
This is the sample code, it is working fine, I know it's not a standard way of coding but I don't know what is the standard code for this instance.
I have to extract 5000-10000 elements from each string, so is there any fastest and standard code for this, I think my solution will be too slow.
IList<IWebElement> ARNum = driver.FindElement(By.XPath("sumXpath1"));
IList<IWebElement> MPNum = driver.FindElement(By.XPath("sumXpath2"));
IList<IWebElement> MGNum = driver.FindElement(By.XPath("sumXpath3"));
int RowARNum=1;
foreach(IWebElement artNum in ARNum) {//for First Column
RowARNum++;
XLWorkSheet.Cells(RowARNum, 1) = artNum.Text;
}
int RowMPNum =1;
foreach(IWebElement mpNum in MPNum){ //for Second Column
RowMPNum++;
XLWorkSheet.Cells(RowMPNum, 1) = mpNum.Text;
}
int RowMGNum =1;
foreach(IWebElement mgNum in MGNum){ //for Third Column
RowMGNum++;
XLWorkSheet.Cells(RowMGNum, 1) = mgNum.Text;
}
Try this, It should hopefully speed up the processing.
Maybe try and add the
StopWatch()class to time your implementation compared to mine?