【问题标题】:i can't have an attribute from an xpath with selenium我不能从带有硒的 xpath 中获得属性
【发布时间】:2012-08-01 12:18:51
【问题描述】:

我正在使用 selenium,我需要填写字段,我的问题是我需要从那里知道这些字段的名称 xpath,我使用 selenium.getAttribute(myxpath) 但它不起作用这是我的 java代码:

  List<String> att= new ArrayList<String>();
    for(String ills:lls){
        att.add(selenium.getAttribute(ills));
    }
    logger.info("ma liste des attributs :"+att);

lls 是包含我所有 ids 的数组列表。 在我的控制台中我有 错误:元素形式:blocConfigurations:configurations:0:parametrage:options:1:option:parametres:0:parametre:valeu not found

提前致谢

【问题讨论】:

    标签: java xpath selenium


    【解决方案1】:

    这是上述场景的解决方案

     String test= selenium.getAttribute("//input[@id='ID']@name");
     System.out.println(test);
    

    【讨论】:

      猜你喜欢
      • 2022-01-21
      • 1970-01-01
      • 1970-01-01
      • 2013-07-16
      • 1970-01-01
      • 2023-02-20
      • 1970-01-01
      • 2017-08-11
      • 2016-01-06
      相关资源
      最近更新 更多