Jump to content
Sign in to follow this  
Invincable

IE Radio Button Problem

Recommended Posts

Invincable

I am having difficulties selecting a particular radio button on a website for a script I have been writing. I select various other radio buttons with no problems, however no matter what I try I cannot seem to select the first radio button. Can anyone please provide some incite into why this is not working.

Here is a snippet of the html code I cannot select

<html>

                     
<form name="formName" method="post" action="/test/results">


Please check the following radio button to continue<BR>                                    
<INPUT type=RADIO name="Layer1" value="abc" ><BR>
OK<BR>

</html>

This is how I believe the _IEFormElementRadioSelect function is supposed to work.

#include<IE.au3>
    
    $oIE = _IECreate(@ScriptDir & "\example2.html")
    $o_form = _IEFormGetObjByName ($oIE, "formName")
    _IEFormElementRadioSelect($o_form,"abc","Layer1",1,"byValue")

Share this post


Link to post
Share on other sites
big_daddy

This is a known bug, but you can work around it like this.

#include <IE.au3>

$oIE = _IECreate(@ScriptDir & "\example2.html")
$oForm = _IEFormGetObjByName($oIE, "formName")
$oRadio = _IEFormElementGetObjByName($oForm, "Layer1")
If Not $oRadio.checked Then
    With $oRadio
        .checked = True
        .fireEvent ("onchange")
        .fireEvent ("onclick")
    EndWith
EndIf

Share this post


Link to post
Share on other sites
Invincable

Hey big_daddy thanks for this. I spent hours hitting my head against the wall because I could not figure this out.

Share this post


Link to post
Share on other sites
big_daddy

Your welcome!

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  

×