【问题标题】:How to locate a list of elements with @FindBy如何使用@FindBy 定位元素列表
【发布时间】:2015-07-02 13:37:09
【问题描述】:

在 FluentLenium 中使用页面时,@FindBy 可用于定位 FluentWebElement:

@FindBy(id = "one")
FluentWebElement exactlyOne;

这工作得很好。但现在我需要定位多个元素:

@FindBy(tagName = "p")
List<FluentWebElement> allP;

我不能让它工作。我尝试将字段声明为:List、FluentList 甚至 List,但我总是得到 null。

我正在使用:Selenium:2.46.0,FluentLenium:0.10.3

【问题讨论】:

    标签: selenium fluentlenium


    【解决方案1】:

    我检查了源代码,似乎(尚未发布)版本 0.10.4 已修复。

    @FindBy(className = "small")
    FluentList<FluentWebElement> smalls;
    

    提交详情:https://github.com/FluentLenium/FluentLenium/commit/2e22e244caa0b4b178ec72ceddd8680c6fbe4c46

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-10-10
      • 2021-06-02
      • 2018-03-31
      • 2021-05-01
      • 2017-01-07
      • 2023-03-28
      • 1970-01-01
      • 2018-05-06
      相关资源
      最近更新 更多