How to check if a Radio Button is checked

Hello!

I have a query about how to check whether a radio button has been selected. For the process I’m developing, I need to check whether one of six radio buttons has been selected.

image

I then need to write what button has been selected into excel.

Has anyone got any ideas of what I could do?

Thanks in advance

You can use “ Get Attribute ” Activity with “ checked ” Attribute selection.

Regards,
Karthik Byggari

2 Likes

Hi @william.coulson,

Would these threads help you: Is the checkbox checked?
How to check wether check box is checked or not and radio button value whether it is "Male" or "Female"
Checking check box

Try this:

Repeat everything in the do sequence for all 6 options (Minutes, Hours, Days. Weeks, Months, Years). Also ensure that in your image exists activities, the option must be pre-selected so that it knows if it has been selected or not. Also reduce the timeout on the Image exists activity to something like 1000 milliseconds.

1 Like

@Leon_Petrou,

Like this? And repeat it for every button?

That is correct. Have you run it? Let me know if it works / doesn’t work.

I asked the client if any records ran on the minute and year options and they said no, so I made daily, weekly and monthly first as I forgot about hourly. I then attempted to add hourly, and put the if statements in the else section. It was running fine before I added it, and now it is typing hourly into daily records, but keeps weekly records as weekly. I would attach a screenshot but it is difficult to see all the if statements

Hey @Leon_Petrou,

I am now having an issue getting past the third if statement. The current order is Hours, Days, Weeks, Months, then minutes. There is a few sets of test data for minutes, and when it gets to these parts, it will stop at weeks and write that into excel. Any suggestions?

Don’t put anything in the else sections of the If statement, put everything separately. Also remember to ensure the radio button is checked when using the image exists activity.

@Leon_Petrou,

I can’t do them one after another as I have to do multiple records, inside a for each. If they follow eachother one by one, it will run through all of them.

Yes that is true, it will run through all of them, but then the Boolean result of the image exists will be False and will run through the Else of the if statement which is blank so nothing will happen. Something will only happen when one of the image exists activities are True, where it will then run through the Then section of the if statement. I also just advised to minimise the timeout to one second so that it doesn’t take 30 seconds for each of the image exists activities.

It seems to be setting all the boolean variables as true, and attempting to run through all the then sections of the if statements. Would making a sequence to set all the boolean variables to false before the if statements be worth doing?

I doubt that will make a difference, it is detecting a selected ratio button the same as an unselected radio button. This is probably because the accuracy has a default value of 0.8 my guess would be to change this accuracy value to be more accurate. First try 0.9 then try 0.95 then try 1.0.

image

Just finished running the entire process, every record was filled out correctly. Thank you very much for your help! I set the accuracy to 0.9 and it had no issues at all. Thank you for your time and effort

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.