Sign in to follow this  
Followers 0
poisonkiller

IE form radio checking

4 posts in this topic

I'm making a auto-login script, but I'm having trouble with checking radio button in IE form. Here's the pages script(partial):

<h3 id="ls_login" class="sidehead">Login</h3>
                        <div class="sidecontent">
                            <form method="post" action="login.php">
                            <label for="username" class="fieldlabel">Kasutajanimi:</label>

                            <input type="text" name="cuser" id="username"class="inputfield"/>
                            <label for="password" class="fieldlabel">Parool:</label>
                            <input type="password" name="cpass" id="password" class="inputfield"/>
                            <div><p>Choose world:</p></div>
                            <div class="worldbuttons">
                                <div class="green"><input type="radio" name="world" value="2" /></div>
                                <div class="red"><input type="radio" name="world" value="3" /></div>
                                <div class="black"><input type="radio" name="world" value="4" /></div>

                                <div class="white"><input type="radio" name="world" value="5" /></div>
                            </div>
                            <p><button type="submit">Logi Sisse</button></p>
                            <p><button type="button" onclick="window.location.href='index.php?a=3'">Registreeru</button></p>
                            <p><a href="index.php?a=55">Unustasid parooli?</a></p>
                            </form>
                        </div>

I want to be able to check green, red, black or white world, but I just can't. Any ideas?

Share this post


Link to post
Share on other sites



Assuming this is the first form in source order, this should work.

#include <IE.au3>

$sURL = "YourWebpage.com"

_IEErrorHandlerRegister()
$oIE = _IECreate($sURL)
$oForm = _IEFormGetCollection($oIE, 0)
_IEFormElementRadioSelect($oForm, 2, "world") ; Green
Sleep(1000)
_IEFormElementRadioSelect($oForm, 3, "world") ; Red
Sleep(1000)
_IEFormElementRadioSelect($oForm, 4, "world") ; Black
Sleep(1000)
_IEFormElementRadioSelect($oForm, 5, "world") ; White

Share this post


Link to post
Share on other sites

Thanks! Works perfectly!

Share this post


Link to post
Share on other sites

Thanks! Works perfectly!

You're 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  
Followers 0