java - Include CSV or XLXS file for selenium -
i'm trying copy value row on csv or xlxs file , paste textfield on firefox , action , loop until end of csv file.
after few research discovered selenium firefox automatize tasks.
does have idea of how implementation or me writing this?
thanks in advance
you need csv parser csvreader . can use following code starting point , build on it. hope helps. happy coding.
public string getvalue(string filename, string rownum, int colheader) { string returnval = null; string relativepath = system.getproperty("user.dir"); string csvpath = relativepath + "\\src\\main\\resources\\csv\\" + filename + ".csv" ; csvreader r; try { r = new csvreader(csvpath); while(r.readrecord()) { string row = r.get(0); if(row.equalsignorecase(rownum) ) { returnval = r.get(colheader); break; } } r.close(); } catch (filenotfoundexception e) { e.printstacktrace(); } catch (ioexception e) { e.printstacktrace(); } return returnval; }
Comments
Post a Comment