1.

How to check if the button is enabled on the page?

Answer»

Using the radio button we are able to select only one OPTION from the options available and radio buttons can be toggled only by Click() method.

We should ensure the following things before performing any ACTION on the Radio buttons -

  • A radio button is displayed on the webpage
  • Radio is enabled on the webpage
  • Check the default SELECTION of the Radio button

Using a predefined isEnabled() method in SELENIUM WebDriver you can confirm whether the radio button is enabled or not.

For ex. While automating radio buttons on flight reservation site you can check -

tripRadioBtn = driver.findElement (By.locator("locator value")); tripRadioBtn.isEnabled()

This will RETURNS a Boolean value, if the output is  true then said radio button is enabled on the webpage, or output is False.



Discussion

No Comment Found