File src = new File("F:\\Screenshots\\Book1.xlsx");
FileInputStream fis = new FileInputStream(src);
XSSFWorkbook wb = new XSSFWorkbook(fis);
XSSFSheet sheet1 = wb.getSheetAt(0);
String data0 = sheet1.getRow(0).getCell(0).getStringCellValue();
//System.out.println("Data from Excel is "+data0);
System.setProperty("webdriver.gecko.driver", "C:\\Selenium\\geckodriver.exe");
WebDriver driver = new FirefoxDriver();
driver.navigate().to("https://maps.mapmyindia.com/");
driver.findElement(By.xpath(".//*[@id='auto']"))
我想将data0的值赋给该xpath字段,请建议我该怎么做。通过这种方式,我将能够从Excel工作表中获取数据。