Jump to content

Recommended Posts

Posted

I am trying to automate a simple sign-in to an internal corporate SSO site.  

I have tried the examples listed here and on YouTube but they fail.   Tried reading in the form as well as searching for the input object directly. Here is what I came up with...

 

#include <IE.au3>

Global $oIE = _IECreate('https://websso.dolgen.net/ssoa/default.aspx?siteid=9070', 0, 1, 0, 1)


Local $oForm = _IEFormGetObjByName($oIE,"form1")

Local $oEID = _IEFormElementGetObjByName($oForm,"Username")
Local $oInitials = _IEFormElementGetObjByName($oForm,"Initials")
Local $oPassword = _IEFormElementGetObjByName($oForm,"Password")

_IEFormElementSetValue($oEID, "1234")
_IEFormElementSetValue($oInitials, "DG")
_IEFormElementSetValue($oPassword, "1234")

 

The above errors on the $oForm declaration.  Console output:

Local $oCol = $oObject.document.forms.item($sName)

 

#include <IE.au3>

Global $oIE = _IECreate('https://websso.dolgen.net/ssoa/default.aspx?siteid=9070', 0, 1, 0, 1)

Local $oEID = _IEGetObjByName($oIE,'Username')
Local $oIntials = _IEGetObjByName($oIE,'Initials')
Local $oPassword = _IEGetObjByName($oIE,'Password')

_IEFormElementSetValue($oEID, "1234")
_IEFormElementSetValue($oInitials, "DG")
_IEFormElementSetValue($oPassword, "1234")

 

Output: If IsObj($oObject.document.GetElementsByName($sName).item($iIndex)) Then
If IsObj($oObject^ ERROR

 

I've attached the html.  Any help is appreciated.

site.txt

Posted

Hi and welcome to the forums! 👋

I would look into check for errors with the @error macro. Basically, if you call a function and it has an issue, it will usually return an error though this. Here's an example with _IECreate

#include <IE.au3>

test()

Func test()
  Local $oIE = _IECreate("www.google.com", 0, 1, 1, 1)
  If @error Then MsgBox(0, "Error", "Can't create IE object")
EndFunc

Then when I see this error, I look up _IECreate in the HelpFile to see what that particular error means

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

Posted
36 minutes ago, seadoggie01 said:

 

Then when I see this error, I look up _IECreate in the HelpFile to see what that particular error means

--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_ClientDisconnected (-2147023174, Browser has been deleted prior to operation.)
"C:\Program Files (x86)\AutoIt3\Include\IE.au3" (1876) : ==> The requested action with this object has failed.:
If IsObj($oObject.document.GetElementsByName($sName).item($iIndex)) Then
If IsObj($oObject^ ERROR
>Exit code: 1    Time: 8.829

I looked in the _IECreate article in HelpFile and it looks like exit code 1 is...

1 ($_IEStatus_GeneralError) - General Error

 

Here is code after following your advice...

#include <IE.au3>

DGPreStage()

Func DGPreStage()

Global $oIE = _IECreate('google.com, 0, 1, 1, 1)
  If @error Then MsgBox(0, "Error", "Can't create IE object")

;Local $oForm = _IEFormGetObjByName($oIE,"form1")
;Local $oTable = IETableGetCollection($oIE, "form")


Local $oEID = _IEGetObjByName($oIE,'Username')
Local $oIntials = _IEGetObjByName($oIE,'Initials')
Local $oPassword = _IEGetObjByName($oIE,'Password')

;~ Local $oEID = _IEFormElementGetObjByName($oForm,"Username")
;~ Local $oInitials = _IEFormElementGetObjByName($oForm,"Initials")
;~ Local $oPassword = _IEFormElementGetObjByName($oForm,"Password")

_IEFormElementSetValue($oEID, "1234")
_IEFormElementSetValue($oInitials, "DG")
_IEFormElementSetValue($oPassword, "1234")

EndFunc

 

Posted

I also found a separate post where Danp2 recommend this..

IECreate("https://gate.opentext.com/Citrix/StoreFront-OTWeb/",0,1,0)
Sleep(2000)
$oIE = _IEAttach("gate.opentext.com", "url")
_IELoadWait($oIE)

 

My code after including this...

#include <IE.au3>

DGPreStage()

Func DGPreStage()

_IECreate('google.com', 0, 1, 1, 1)
Sleep(2000)
Local $oIE = _IEAttach('google.com', 'url')
_IELoadWait($oIE)

If @error Then MsgBox(0, "Error", "Can't create IE object")
;Local $oForm = _IEFormGetObjByName($oIE,"form1")
;Local $oTable = IETableGetCollection($oIE, "form")

Local $oEID = _IEGetObjByName($oIE,'Username')
Local $oInitials = _IEGetObjByName($oIE,'Initials')
Local $oPassword = _IEGetObjByName($oIE,'Password')

_IEFormElementSetValue($oEID, "1234")
_IEFormElementSetValue($oInitials, "DG")
_IEFormElementSetValue($oPassword, "1234")

EndFunc

This successfully input the text into the textboxes without triggering the error box.  Very appreciative of the two of you for your responses and your help.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...