我在测试FluentLenium。
我发现输入是"fill("#sb_form_q").with("FluentLenium");“。
我希望选中和取消选中复选框。
我想在一组中选择一个单选按钮。
怎么办?
发布于 2014-06-29 03:56:27
如果你想点击id为"male“的单选按钮,只需这样做:
find("#male").click();您可以使用任何css选择器来查找所需的元素(单选按钮或复选框)并对其执行操作(大多数情况下通过单击)。
发布于 2017-10-17 22:53:54
如果您有一个元素,如:
<input type="radio" id="radioButton1">您可以使用Lazy Find Annotation:
@Findby(id = "radioButton1")
FluentWebElement radioButton;或定位器:
FluentWebElement radioButton = el("input", with("id").equalTo("radioButton1");我更喜欢第二种方法,因为你可以添加更多的选择器来确保你找到你想要的元素,第一种方法是为了便于使用/可读性。
然后,您可以使用FluentWebElement的方法来单击和取消单击。
radioButton.click(); /* Selects */
radioButton.click() /* Unselects */您不会使用fill方法。
https://stackoverflow.com/questions/24456457
复制相似问题