[英]How to read data from application(in tables) of a webpage and then write it in excel?
Should I use array as a medium to store the read data and then write it in excel? 我应该使用数组作为媒介来存储读取的数据,然后将其写入excel吗? Have to carry out the following steps: 1. There are some data on Page1 of the application: Need to read that data 2. Write that data in an excel sheet. 必须执行以下步骤:1.在应用程序的Page1上有一些数据:需要读取该数据2.在Excel工作表中写入该数据。 3. Print action on Page2 leads to a Report generation. 3.在Page2上执行打印操作将生成报告。 4. Assert those printed data with excel. 4.使用excel声明那些打印数据。
Please suggest. 请提出建议。 Thanks 谢谢
1st step: Reading data from application, and storing in list. 第一步:从应用程序中读取数据,并存储在列表中。
List< WebElement> myList=driver.findElements(By.xpath(some path));
for(WebElement e : myList){
System.out.println(e.getText());
}
2nd step: How to write this data to excel?
将Map与String和List一起使用
Map<String, List<String>> tableMap = new HashMap<String, List<String>();
you can use list to store the data from the application. 您可以使用列表来存储应用程序中的数据。
List myElements = driver.findElements(mySelector); 列出myElements = driver.findElements(mySelector);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.