Here is my HTML code
You can try any of this method:-
selenium.isChecked(Locator);
List<WebElement> radio = driver.findElements(By.name("address"));
radio.get(0).getAttribute("checked"));
Hope it will help...
.isSelected() function will returns you a boolean value "True" or "False" ,depending on that you can check the condition and enable or leave the radio button selected. driver.findElement(By.cssSelector("input[id='26110162']")).isSelected().
Declare a boolean value and store the result then provide an if condiiton to validate
driver.findElement(By.id("26110162")).isSelected();
or
String str = driver.findElement(By.id("26110162")).getAttribute("checked");
if (str.equalsIgnoreCase("true"))
{
System.out.println("Checkbox selected");
}
if the ID is changing... use the following XPATH:
//input[span='Seleccionar como tarjeta predeterminada']
or
//input[@name='address' and @type='radio']