2

I'm testing FluentLenium.

I found "fill("#sb_form_q").with("FluentLenium");" for input(s).

I want check and uncheck Checkbox.

I want choose a radiobutton in a group.

How to do ?

dterencio
  • 31
  • 4

2 Answers2

2

If you want to click on the radiobutton that have the id "male" just do something like that :

find("#male").click();

You could use any of the css selectors to find the element you want (radiobutton or checkbox) and act on it (most of the time by clicking).

Mathilde
  • 98
  • 4
0

If you have an element such as:

<input type="radio" id="radioButton1">

You can use either the Lazy Find Annotation:

@Findby(id = "radioButton1")
FluentWebElement radioButton;

Or the locators:

FluentWebElement radioButton = el("input", with("id").equalTo("radioButton1");

I prefer the second method for accuracy since you can add more selectors to ensure you find the exact element you want to, the first for ease-of-use/readability.

Then you can use the FluentWebElement's methods to click and unclick.

radioButton.click(); /* Selects   */
radioButton.click()  /* Unselects */

You would not use fill method.

code_disciple1
  • 91
  • 1
  • 11