我的硒WebDriver中没有调用getColumnCount()

我正在使用Selenium-2.53.1 jar和Apache poi-3.17 jars的组合在Selenium中使用.xlsx工作表。当我尝试通过使用这些方法获取列总数时,硒不调用getColumnCount()getPhysicalNumberOfCells()。带红线错误的下划线。


Helenr
浏览 140回答 1
1回答

温温酱

您是否在使用如下代码:&nbsp; &nbsp; &nbsp; &nbsp; XSSFSheet sheet = workbook.getSheet("Sheet name");&nbsp; &nbsp; &nbsp; &nbsp; int noOfRows = sheet.getLastRowNum() + 1;&nbsp; &nbsp; &nbsp; &nbsp; Row row = sheet.getRow(0);&nbsp; &nbsp; &nbsp; &nbsp; int noOfColumns = sheet.getRow(0).getPhysicalNumberOfCells();我正在使用Apache POI依赖项:&nbsp; &nbsp; &nbsp; &nbsp; <dependency>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <groupId>org.apache.poi</groupId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <artifactId>poi-ooxml</artifactId>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <version>3.15</version>&nbsp; &nbsp; &nbsp; &nbsp; </dependency>希望对您有帮助:)
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java