Jump to content

Recommended Posts

Posted

Hi All,

I am having a bit of trouble filling in some input boxes on a certain website. I have tried all kinds of different iterations of the following script, but can't get anything to work.

#include <IE.au3>
Run("C:\Program Files (x86)\Internet Explorer\iexplore.exe -new http://acc.rollernet.us/","")
$RollerHwnd = WinWaitActive("[TITLE:Roller Network Control Center - Windows Internet Explorer; CLASS:IEFrame]")
$rollerIE = _IEAttach($RollerHwnd,"HWND")
$rollerForm = _IEFormGetCollection($rollerIE)
;Logs into the Rollernet admin portal
$roller_username = _IEFormElementGetObjByName($rollerForm,"username")
$roller_password = _IEFormElementGetObjByName($rollerForm,"password")
_IEFormElementSetValue($roller_username,"Username")
_IEFormElementSetValue($roller_password,"Password")

I have used a variation of this exact code for another website without any problems. Does anyone see what I am missing? Any help would be greatly appreciated!

Posted (edited)

You need to add some error checking to your code! Every _IE* function sets @error if there was a problem.

Edited by water

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Thanks water. I didn't do any error checking with @error, but here is the output when I run the script:

IE.au3 V2.4-0 Error from function _IEPropertyGet, $_IEStatus_InvalidObjectType

--> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidObjectType

--> IE.au3 V2.4-0 Error from function _IEFormElementGetObjByName, $_IEStatus_InvalidObjectType

--> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

--> IE.au3 V2.4-0 Error from function _IEFormElementSetValue, $_IEStatus_InvalidDataType

From all of my testing, it seems that the problem exists around the _IEFormGetCollection function. Is that the best way to get the password and username input fields? They are in an unamed form which makes things interesting as well.

Posted

Thanks DedekPredek. Did you test that out on your machine at all? I had tried that before and it actually gives me the same errors as my previous post, but with

--> IE.au3 V2.4-0 Warning from function _IEFormGetCollection, $_IEStatus_NoMatch

added. Any other suggestions?

Posted

horstj,

Try it with WinWait and _IELoadWait, it works for me

#include <IE.au3>
Run("C:\Program Files (x86)\Internet Explorer\iexplore.exe -new https://acc.rollernet.us/","")
$RollerHwnd = WinWait("Roller Network Control Center - Windows Internet Explorer","")
$rollerIE = _IEAttach($RollerHwnd,"HWND")
_IELoadWait($rollerIE)

DedekPredek

Posted (edited)

Dedek, Sorry for my ignorance here, but would my code now look like this

#include <IE.au3>
Run("C:\Program Files (x86)\Internet Explorer\iexplore.exe -new https://acc.rollernet.us/","")
$RollerHwnd = WinWait("Roller Network Control Center - Windows Internet Explorer","")
$rollerIE = _IEAttach($RollerHwnd,"HWND")
_IELoadWait($rollerIE)
$rollerForm = _IEFormGetCollection($rollerIE)
;Logs into the Rollernet admin portal
$roller_username = _IEFormElementGetObjByName($rollerForm,"username")
$roller_password = _IEFormElementGetObjByName($rollerForm,"password")
_IEFormElementSetValue($roller_username,"Username")
_IEFormElementSetValue($roller_password,"Password")

I still cannot get it to fill in the username and password fields.

Edited by horstj
Posted

As I said in post #2 you need to add some error checking. Which of the functions you call sets @error?

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

#include <IE.au3>
$oIE=_IECreate("https://acc.rollernet.us")
$oObj = _IEGetObjByName($oIE,"username")
_IEPropertySet($oObj,"innertext","MyUserId")
$oObj = _IEGetObjByName($oIE,"password")
_IEPropertySet($oObj,"innertext","MyPassword")
$oObj = _IEGetObjByName($oIE,"submit")
_IEAction($oObj,"click")
Exit

App: Au3toCmd              UDF: _SingleScript()                             

Posted

As you can see from the help file:

_IEAttach: 7 ($_IEStatus_NoMatch) = No Match ==> The IE instance you try to attach to couldn't be found

_IELoadWait: 3 ($_IEStatus_InvalidDataType) = Invalid Data Type ==> Error caused by unsuccessfull _IEAttach

My UDFs and Tutorials:

  Reveal hidden contents

 

  • 5 years later...
Posted
  On 2/13/2013 at 2:29 PM, Exit said:

 

#include <IE.au3>
$oIE=_IECreate("https://acc.rollernet.us")
$oObj = _IEGetObjByName($oIE,"username")
_IEPropertySet($oObj,"innertext","MyUserId")
$oObj = _IEGetObjByName($oIE,"password")
_IEPropertySet($oObj,"innertext","MyPassword")
$oObj = _IEGetObjByName($oIE,"submit")
_IEAction($oObj,"click")
Exit

 

Expand  

How to to fill this forum when webpage already opened ?

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
×
×
  • Create New...