我想比较两个.csv文件,读取单元格值,并在新的excel中显示输出(单元格值)。在selenium java中
目前我的代码如下;我需要在控制台中获得输出,还需要selenium使用cell vales编写一个新的excel文件。可以做些什么 qestion:我想比较两个.csv文件,读取单元格值,并希望它在新的excel中显示输出(单元格值)。在selenium java中我想比较两个.csv文件,读取单元格值,并在新的excel中显示输出(单元格值)。在selenium java中,java,selenium,testing,automation,execution,Java,Selenium,Testing,Automation,Execution,目前我的代码如下;我需要在控制台中获得输出,还需要selenium使用cell vales编写一个新的excel文件。可以做些什么 qestion:我想比较两个.csv文件,读取单元格值,并希望它在新的excel中显示输出(单元格值)。在selenium java中 { String path="C:\\..."; String file1="file1.csv"; String file2="file2.csv";
{
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`
}
}
{
String path=“C:\\…”;
字符串file1=“file1.csv”;
字符串file2=“file2.csv”;
ArrayList al1=新的ArrayList();
ArrayList al2=新的ArrayList(){
//ArrayList al3=新的ArrayList();
试一试{
BufferedReader CSVFile1=新的BufferedReader(新文件读取器(路径+文件1));
字符串dataRow1=CSVFile1.readLine();
{
while(dataRow1!=null)
{
字符串[]dataArray1=dataRow1.split(“,”);
用于(字符串项1:dataArray1)
{
al1.增加(第1项);
}
dataRow1=CSVFile1.readLine();//读取下一行数据。
}
CSVFile1.close();
}
BufferedReader CSVFile2=新的BufferedReader(新文件读取器(路径+文件2));
字符串dataRow2=CSVFile2.readLine();
while(dataRow2!=null)
{
字符串[]dataArray2=dataRow2.split(“,”);
用于(字符串项2:dataArray2)
{
al2.增加(第2项);
}
dataRow2=CSVFile2.readLine();//读取下一行数据。
}
CSVFile2.close();
用于(字符串bs:al2)
{
al1.移除(bs)``
}
int size=al1.size();
System.out.println(大小);`在这里输入代码`
}
}