Interacting with Checkboxes

Checkboxes are widely used in web applications, mostly in situations where the user needs to select one or more available options, for example, when selecting user hobbies in a registration form. WebDriver offers support for checkboxes through the WebElement class.

Here are some of the methods provided so that you can interact with checkboxes groups elements during the execution of a script:

  • boolean isSelected(): Indicates if an element is selected or not. It applies to input elements such as checkboxes, options in a select button, or in a radio button.
  • void click(): Performs a click on an element. It can only be used on visible elements with a width and height bigger than zero (0). If by clicking an element a new page is loaded, all previous references to the element will be invalid.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.10.137