简体   繁体   中英

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?

Can I find to use value=checkbox?

You can do it using cssSelector with @FindBy attribute. See this

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

But, as alecxe has mentioned this selector is not very stable and unique. In order us to help you, you need to provide more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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