Jump to content

IE Form value clears when clicked


Recommended Posts

I'm trying to make an auto-login script for betfair.com.

In the code below I've read and printed out the id of each form element - this helped me find the username and password fields.

#include<IE.au3>

$oIE = _IECreate("http://www.betfair.com/exchange")

$oForms = _IEFormGetCollection($oIE)
$formcount = 0;

For $oForm In $oForms
  
   $formcount = $formcount+1
   $newID = $oForm.id
   ConsoleWrite(@CRLF & 'formcount = ' & $formcount & @CRLF)
   ConsoleWrite('New ID = ' & $newID & @CRLF)
  
   If $formcount = 2 Then ; login form is the 2nd form on the webpage
      Local $oQuery = _IEFormElementGetCollection($oForm, -1)
      $elementcount = 0
      
      For $oQuery2 In $oQuery ; read through the ogin form
         
         ; print details of each element of form
         $elementcount = $elementcount + 1
         ConsoleWrite('$elementcount = ' & $elementcount & @CRLF)
         $a = _IEFormElementGetValue( $oQuery2 )
         ConsoleWrite('$a = ' & $a & @CRLF)

         If $elementcount = 4 Then ; username field
            _IEFormElementSetValue( $oQuery2  ,"MYUSER")

         EndIf
         
         If $elementcount = 6 Then ; password field
            _IEFormElementSetValue( $oQuery2  ,"MYPASS")
         EndIf

      Next

   EndIf
   
Next

However, after the script has run, if I click on the "password" field in the webpage, the string "MYPASS" disappears. Does this mean I didn't set the form element value correctly?

The html code for the form is a bit complex, perhaps someone can see something in it that I don't understand well enough to spot.
 

Link to comment
Share on other sites

  • 3 weeks later...

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
 Share

×
×
  • Create New...