Currently my code is as below; i need to get the output in the console and also want the selenium to write a new excel file with cell vales. What can be done?
qestion:I want to compare two .csv files and want to read the cell values and want it to display the output (cell values) in a new excel. In selenium java.
{
String path="C:\\...";
String file1="file1.csv";
String file2="file2.csv";
ArrayList<String> al1=new ArrayList<String>();
ArrayList<String> al2=new ArrayList<String>();{
//ArrayList al3=new ArrayList();
try {
BufferedReader CSVFile1 = new BufferedReader(new FileReader(path+file1));
String dataRow1 = CSVFile1.readLine();
{
while (dataRow1 != null)
{
String[] dataArray1 = dataRow1.split(",");
for (String item1:dataArray1)
{
al1.add(item1);
}
dataRow1 = CSVFile1.readLine(); // Read next line of data.
}
CSVFile1.close();
}
BufferedReader CSVFile2 = new BufferedReader(new FileReader(path+file2));
String dataRow2 = CSVFile2.readLine();
while (dataRow2 != null)
{
String[] dataArray2 = dataRow2.split(",");
for (String item2:dataArray2)
{
al2.add(item2);
}
dataRow2 = CSVFile2.readLine(); // Read next line of data.
}
CSVFile2.close();
for(String bs:al2)
{
al1.remove(bs);``
}
int size=al1.size();
System.out.println(size);`enter code here`
}
}
Aucun commentaire:
Enregistrer un commentaire