InterviewSolution
| 1. |
How to work with Radio Buttons? |
|
Answer» Using the radio button we will be 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 the click event on the Radio buttons -
By using the Click() method in SELENIUM you can perform the action on the Radio button. For ex. tripRadioBtn = driver.findElement (By.id("oneway")); tripRadioBtn.click();Selenium WebDriver has predefined METHODS - isDisplayed() method - WebElement tripRadioBtn = driver.findElement (By.id("id value"));It will check tripRadioBtn.is displayed. This will returns a Boolean value, if it returns true then said radio button is present on the webpage, or it returns False. isEnabled() method - tripRadioBtn.isEnabled()This will returns a Boolean value, if it returns true then said radio button is enabled on the webpage, or it returns False isSelected() method - tripRadioBtn.isSelected()This will returns a Boolean value, if it returns true then said radio button is SELECTED, or it returns False |
|