excel - How to add IList<IWebElement> in Arrays Selenium -


i new both c# , selenium.

this sample code, working fine, know it's not standard way of coding don't know standard code instance.

i have extract 5000-10000 elements each string, there fastest , standard code this, think solution 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, should speed processing.

maybe try , add stopwatch() class time implementation compared mine?

        ilist<iwebelement> arnum = driver.findelements(by.xpath("sumxpath1"));         ilist<iwebelement> mpnum = driver.findelements(by.xpath("sumxpath2"));         ilist<iwebelement> mgnum = driver.findelements(by.xpath("sumxpath3"));          parallel.for(0, arnum.count(), =>         {             xlworksheet.cells(i, 1) = arnum[i].text;         });          parallel.for(0, mpnum.count(), =>         {             xlworksheet.cells(i, 1) = mpnum[i].text;         });          parallel.for(0, mgnum.count(), =>         {             xlworksheet.cells(i, 1) = mgnum[i].text;         }); 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -