-
Notifications
You must be signed in to change notification settings - Fork 108
CheckBox
Taisiia-Kozlova edited this page Nov 7, 2017
·
3 revisions
CheckBox – the element that allows user to make a binary choice, and thus, it may be put into one of the two states: checked or unchecked.
Example:
JDI provides the following methods, which enable interactions with checkboxes:
Here is the list of available methods.
Method | Description | Return Type |
---|---|---|
check() | Set checkbox checked | void |
uncheck() | Set checkbox unchecked | void |
isChecked() | Verify checkbox is checked | Boolean |
click() | Change checkbox state | void |
Initialization:
@FindBy(xpath = "//checkbox xpath")
public CheckBox checkBox;
Action > Examples:
@Test
public void checkBoxActionExamples() {
checkBox.check();
Assert.assertTrue(checkBox.isChecked()));
checkBox.uncheck();
Assert.assertFalse(checkBox.isChecked()));
if (!checkBox.isChecked())
checkBox.click();
}