简体   繁体   English

Selenium WebDriver-用@FindBy注释查找复选框的方法是什么?

[英]Selenium WebDriver - What is the way to find checkbox with @FindBy annotation?

I want to find this checkbox 我想找到此复选框

<input type="checkbox" ... />

what is way to use @FindBy annotation? 使用@FindBy注释的方法是什么?

Can I find to use value=checkbox? 我可以找到使用value = checkbox吗?

You can do it using cssSelector with @FindBy attribute. 您可以使用具有@FindBy属性的cssSelector来实现。 See this 看到这个

@FindBy(css = "[type='checkbox']")
private WebElement foo;

But, as alecxe has mentioned this selector is not very stable and unique. 但是,正如alecxe提到的那样,该选择器不是非常稳定和独特。 In order us to help you, you need to provide more information. 为了帮助您,您需要提供更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM