簡體   English   中英

如何從網頁的應用程序(表中)中讀取數據,然后在excel中寫入數據?

[英]How to read data from application(in tables) of a webpage and then write it in excel?

我應該使用數組作為媒介來存儲讀取的數據,然后將其寫入excel嗎? 必須執行以下步驟:1.在應用程序的Page1上有一些數據:需要讀取該數據2.在Excel工作表中寫入該數據。 3.在Page2上執行打印操作將生成報告。 4.使用excel聲明那些打印數據。

請提出建議。 謝謝

第一步:從應用程序中讀取數據,並存儲在列表中。

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>();

您可以使用列表來存儲應用程序中的數據。

列出myElements = driver.findElements(mySelector);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM