Skip to main content

Displays error while select radio button in selenium

I'm writing testcases to select 7 radio buttons. While select the radio button it displays run time error.

I have tried with below code :

public void selecttemplate()
{
    
    List<WebElement> rdBtn = driver.findElements(By.name("Template_Type"));             
    int size=rdBtn.size();
    
    for(int i=0;i<size;i++)
    {
        String val=rdBtn.get(i).getAttribute("value");
    
        if(val.equals("Documents"))
        {
            rdBtn.get(i).click();
            break;
        }
    }
    WebElement save=driver.findElement(By.name("register-button"));
    save.submit();
}

Below is error snap:

enter image description here

Rutvi Soni
  • 536
  • 1
  • 11
  • 27