Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

How to make condition to perform multiple radio button click (see image below)...?

multiple radio button click

I've tried for hours, but I got only single radio button click (see attached image)

single radio button click

List<WebElement> radiobutton = driver.findElements(By.xpath("//*[@type='radio']"));
    System.out.println("Total element is " + radiobutton.size());

    for (int i = 0; i < radiobutton.size(); i++) {

        // if you are getting stale element exception because of the page
        // reload
        radiobutton = driver.findElements(By.xpath("//*[@type='radio']"));

        System.out.println(radiobutton.get(i).getAttribute("value"));

        // select your radio and click to go to next page
        radiobutton.get(i).click();

        Thread.sleep(3000);

        driver.findElement(By.xpath("//input[@id='btnCheckFare']"))
                .click();

        Thread.sleep(3000);
    }
share|improve this question
1  
Why do not you show that you have tried already. –  Saifur yesterday
    
Only one radio button can be selected in a group! Do you mean select one by one? And post the HTML for better responses. –  Sham yesterday
    
You can see in this video multiple radio button using human interaction youtu.be/KxydkdhNdYc?t=143 –  Agung Pambudi yesterday

1 Answer 1

I saw your video.You have multiple groups of radio button and you can select one radio button in each group.

You have to use 2 loops,one for group and one inner loop for select radio button in a group.

If you have experience in programming then you can do it easily.Otherwise provide the link where we can see this functionality.

share|improve this answer
    
Please tell me where I can see this? It will save my time. –  Aru yesterday
    
Hello @Aru, I've made a guide to you. Please visit this url drive.google.com/file/d/0B9-9eJW3sN3taVZxbGl0REhHMjA/… –  Agung Pambudi 13 hours ago
    
I am trying to select multiple radios option but I am not able to do this.I can select 1 or 2 radios same time.When I select any radio button,spinner is displayed. –  Aru 23 mins ago
    
I am trying to select multiple radios options but I am not able to do this.I If you want to select randomly then you can get element by id,each radio button has id.You didn't explain in which way you want to select these radio buttons.Even you didn't explain when 'Check fare' button is enabled.If you'll not explain your question properly then no body will help you. –  Aru 14 mins ago

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.