Could not automate “Sex” type from “http://toolsqa.com/automation-practice-form/”

Could not automate “Sex” type from “http://toolsqa.com/automation-practice-form/”.

My code snippet is:

boolean defalt = false;

defalt = radioBtn.get(0).isSelected();
if(defalt == true){
radioBtn.get(1).click();
}else{
radioBtn.get(0).click();
}

And i get the below error message:

Exception in thread “main” java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(Unknown Source)
at java.util.ArrayList.get(Unknown Source)
at AutomationTest.CheckRadioButton.main(CheckRadioButton.java:19)

Please help me to resolve this problem.

Default Asked on May 15, 2017 in Selenium WebDriver.

Please paste the entire code.

on May 16, 2017.
Add Comment
  • 0 Answer(s)
  • Your Answer

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