Significance of the keyword LIST

Hi

Below is an example program on this site. Could you please explain this statement ?

List oRadioButton—–> What is the significance of the keyword LIST does it work the same way as “WebElement” ?

// Store all the elements of same category in the list of WebLements
List  oRadioButton = driver.findElements(By.name(“toolsqa”));
// Create a boolean variable which will hold the value (True/False)
boolean bValue = false;
// This statement will return True, in case of first Radio button is selected
bValue = oRadioButton.get(0).isSelected();
// This will check that if the bValue is True means if the first radio button is selected
if(bValue = true){
// This will select Second radio button, if the first radio button is selected by default
oRadioButton.get(1).click();
}else{
// If the first radio button is not selected by default, the first will be selected
oRadioButton.get(0).click();
}
}
/
Default Asked on August 31, 2015 in Selenium WebDriver.
Add Comment
  • 1 Answer(s)

    Error at line

    List  oRadioButton = driver.findElements(By.name(“toolsqa”));
    it might be

    List<WebElement>  oRadioButton = driver.findElements(By.name(“toolsqa”));
    Reviewer Answered on August 31, 2015.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.