【问题标题】:How to read data from application(in tables) of a webpage and then write it in excel?如何从网页的应用程序(表格)中读取数据,然后将其写入excel?
【发布时间】:2018-04-12 07:46:23
【问题描述】:

我应该使用数组作为媒介来存储读取的数据,然后将其写入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?

【问题讨论】:

  • 1.应用程序列表中的数据

标签: java excel selenium automation report


【解决方案1】:

您可以使用列表来存储来自应用程序的数据。

列出 myElements = driver.findElements(mySelector);

【讨论】:

    【解决方案2】:

    使用 String 和 List 类型的 Map

    Map<String, List<String>> tableMap = new HashMap<String, List<String>();
    

    【讨论】:

      猜你喜欢
      • 2017-10-13
      • 1970-01-01
      • 1970-01-01
      • 2017-10-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-01
      相关资源
      最近更新 更多