Jump to content
Sign in to follow this  
Mingre

How to select radio button using IE.au3

Recommended Posts

Mingre

Question: How do I select a radio button on a google form?

I created a sample google form https://docs.google.com/forms/d/1EbLZlsxtdWTY5zgMjJmJup7fPcc8FQDq6Nb9DC-lBT8/viewform for testing purposes.

I found and used this tool IEautomation Explorer to extract the element names (see below for result):

 

FORMS on this PAGE
There are 1 FORMS on this page
........Form Name:0  Form Number:0 Form Length:10...................
element name: entry.1045134513       value:Option 1
element name: entry.1045134513       value:Option 2
element name: entry.1045134513       value:Option 3
element name: entry.1045134513       value:__other_option__
element name: entry.1045134513.other_option_response       value:0
element name: draftResponse       value:[,,"-4996087789206206034"]

element name: pageHistory       value:0
element name: fromEmail       value:false
element name: fbzx       value:-4996087789206206034
element name: submit       value:Isumite

 

I used the results and did the following script (though I kind of expected it not to work):

#include <IE.au3>

Local $oIE = _IECreate('https://docs.google.com/forms/d/1EbLZlsxtdWTY5zgMjJmJup7fPcc8FQDq6Nb9DC-lBT8/viewform')
Local $oForm = _IEFormGetObjByName($oIE, 0)
_IEFormElementRadioSelect($oForm, "entry.1045134513", "Option 2", 0, "byIndex")

Please help? Thanks.

Share this post


Link to post
Share on other sites
Danp2

There are several issues with your _IEFormElementRadioSelect statement:

  • The 2nd and 3rd parameters are backwards
  • The 4th parameter is telling it to unselect the radio button
  • The 5th parameter should be ByValue.

Try:

#include <IE.au3>
Local $oIE = _IECreate('https://docs.google.com/forms/d/1EbLZlsxtdWTY5zgMjJmJup7fPcc8FQDq6Nb9DC-lBT8/viewform')
Local $oForm = _IEFormGetObjByName($oIE, 0)
_IEFormElementRadioSelect($oForm, "Option 2", "entry.1045134513", 1)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.