简体   繁体   English

如何从网页的应用程序(表中)中读取数据,然后在excel中写入数据?

[英]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.

相关问题 如何在JavaFX应用程序中从Excel读取数据? - How to read data from Excel in JavaFX application? 从网页上读取数据 - Read data from webpage 从 excel 表读取数据并写入同一 excel 表 - Read data from excel sheet and write in the same excel sheet 如何同时从Excel读取和写入? - How to read and write simultaneously from excel? 使用POI读取和写入数据到excel-写入新数据后,它会从excel中删除我的原始数据 - Read and write data to excel using POI - It deletes my original data from excel after write new data 如何从Excel表格中读取测试数据并提供到网页中,并使用POI在硒Web脚本中将测试用例标记为通过或失败 - How to read test data from excel sheet and provide into webpage and mark test case as pass or fail accordigly in selenium web script using POI 如何在应用程序中读取/写入 - How to read / write in application 使用java从Excel读取数据并写入Docx文件 - Read data from Excel and write to Docx file using java 如何从 excel 表中读取数据并使用 selenium 将数据用作网页的输入? 我一次只能读取 1 行。 代码显示: - How do I read data from excel sheet and use data as an input for webpage using selenium ? I am able to read only 1 row at a time. Code displayed: Selenium-java:我想每次从网页到 excel 总是在新行中写入数据 - Selenium-java: I want to write data everytime from webpage to excel always in new row
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM