Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Website Auto login - Variable Must Be Of Type Object?

$
0
0
Hello all,

First off, let me apologize if this is a dumb question.  I've been digging through these forums all morning hoping that I could resolve this myself but I can't seem to figure it out.  So for a work project I have a website I need to auto-login (via IE 8) and then navigate to a specific page to be displayed on a monitor.

The code I have thus far is as follows:

[ autoit ]         
#include <IE.au3> Local $oUser, $oPass, $oSubmit Local $sUser = "myuser" Local $sPass = "mspass" Local $url = "http://10.10.10.10:8080/login/" Local $oIE = _IECreate($url) _IELoadWait($oIE) $oInputs = _IETagNameGetCollection($oIE, "input") for $oInput in $oInputs if $oInput.type = "text" And $oInput.name = "j_username" Then $oUser = $oInput if $oInput.type = "password" And $oInput.name = "j_password" Then $oPass = $oInput if $oInput.type = "submit" And $oInput.value = "Log In" Then $oSubmit = $oInput if isObj($oUser) And isObj($oPass) And isObj($oSubmit) then exitloop Next $oUser.value = $sUser $oPass.value = $sPass _IEAction($oSubmit, "click") _IELoadWait($oIE)

This code will successfully launch IE and navigate to the page I want.  I went with the _IETagNameGetCollection because the "submit" button doesn't give a name or ID, so I couldn't use the _IEGetObjByName or ID.  I did find a link to the IE Debug toolbar, and I have used that to verify that all of these fields/controls are of the correct type and that I'm using the correct names/values. I tried the AutoIt 1-2-3 examples, have watched youtube videos, tried some tutorials for IE from the forums, but I can't seem to get this working.

The specific problem I have when I try to run is:


C:\Documents and Settings\user\Desktop\test.au3 (19) : ==> Variable must be of type "Object".:
$oUser.value = $sUser
$oUser^ ERROR

It's my understanding this is because my variable isn't an object, but I can't understand why? I only started using AutoIt this morning, and I'm trying to get this script working in 4 hours, LOL (not my choice of deadline).  Any assistance would be very appreciated, I just can't see where I'm going wrong here. :(

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>