我試圖通過它下面的代碼: -如何比較網頁上的文字與網頁驅動程序中外部文件中的文字?
BufferedReader in = new BufferedReader(new FileReader("TC5_data.txt"));
String str;
while ((str = in .readLine()) != null) {
System.out.println(str); {
String str1 = driver.findElement(By.xpath("//*[@id='content']/div[2]/table/tbody/tr/td[1]")).getText();
if (str.equals(str1)) {
System.out.println("Data is Matching");
} else {
System.out.println("Data is not Matching");
}
但上面的代碼是不工作對我來說...需要幫助urgntly
更新我的回答 –