Jump to content

Trying to autofill username and password


Recommended Posts

Hello, 

I'm a new to Autoit, i like very much the idea of automatization of work. 😀

For my first task I wanted to automate to process to login to my work VPN. Everything is working fine up to the moment of getting the name of the forms from IE,

I've cut out my code, to the error lines - I want to get collection of the forms on that page, but this code itself is giving me an error:

#include <IE.au3>

$oIE = _IECreate("https://aecom.okta.com/signin/")
Sleep(5000)
$oForm = _IEFormGetCollection($oIE)

 

Error msg: Line 1785

Return SetError($_IESTATUS_Success, 0, $oObject.document)

Return SetError($_IESTATUS_Success, 0, $oObject.^) ERROR

Error: The requested action with this object has failed.

Can someone advise me what I'm doing wrong?

Link to post
Share on other sites

Does this throw the same error?

; Get a reference to the collection of forms on a page,
; and then loop through them displaying information for each

#include <IE.au3>
#include <MsgBoxConstants.au3>

Local $oIE = _IECreate("https://aecom.okta.com/signin/")
Local $oForms = _IEFormGetCollection($oIE)
MsgBox($MB_SYSTEMMODAL, "Forms Info", "There are " & @extended & " form(s) on this page")
For $oForm In $oForms
    MsgBox($MB_SYSTEMMODAL, "Form Info", $oForm.name)
Next

Above is Example 2 of _IEFormGetCollection.

Might be worth registering a error handler. Do a search for _IEErrorHandlerRegister.

Edited by Luke94
Link to post
Share on other sites

I assume IE appears and loads the webpage, correct?

Run this and let us know the output:

; Get a reference to the collection of forms on a page,
; and then loop through them displaying information for each

#include <IE.au3>
#include <MsgBoxConstants.au3>

_IEErrorHandlerRegister('_Error')
Local $oIE = _IECreate("https://aecom.okta.com/signin/")
Local $oForms = _IEFormGetCollection($oIE)
MsgBox($MB_SYSTEMMODAL, "Forms Info", "There are " & @extended & " form(s) on this page")
For $oForm In $oForms
    MsgBox($MB_SYSTEMMODAL, "Form Info", $oForm.name)
Next

Func _Error($oError)
    ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM error handler - COM Error intercepted !" & @CRLF & _
            @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _
            @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _
            @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _
            @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _
            @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
            @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
            @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
            @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
            @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF)
EndFunc

 

Link to post
Share on other sites
--> IE.au3 T3.0-2 Error from function _IELoadWait, $_IESTATUS_ClientDisconnected (-2147023174, Browser has been deleted prior to operation.)
Forum.au3 (1785) : ==> COM error handler - COM Error intercepted !
    err.number is:         0x800706BA
    err.windescription:    The RPC server is unavailable.

    err.description is:     
    err.source is:         
    err.helpfile is:     
    err.helpcontext is:     
    err.lastdllerror is:     0
    err.scriptline is:     1785
    err.retcode is:     0x00000000

Forum.au3 (907) : ==> COM error handler - COM Error intercepted !
    err.number is:         0x000000A9
    err.windescription:    Variable must be of type 'Object'.
    err.description is:     
    err.source is:         
    err.helpfile is:     
    err.helpcontext is:     
    err.lastdllerror is:     0
    err.scriptline is:     907
    err.retcode is:     0x00000000

Forum.au3 (907) : ==> COM error handler - COM Error intercepted !
    err.number is:         0x000000A9
    err.windescription:    Variable must be of type 'Object'.
    err.description is:     
    err.source is:         
    err.helpfile is:     
    err.helpcontext is:     
    err.lastdllerror is:     0
    err.scriptline is:     907
    err.retcode is:     0x00000000

Forum.au3 (12) : ==> COM error handler - COM Error intercepted !
    err.number is:         0x000000A9
    err.windescription:    Variable is not of type 'Object'.
    err.description is:     
    err.source is:         
    err.helpfile is:     
    err.helpcontext is:     
    err.lastdllerror is:     0
    err.scriptline is:     12
    err.retcode is:     0x00000000

>Exit code: 0    Time: 9.82

After pressing F5 I'm getting a bunch of errors. Page is still loading properly.

Link to post
Share on other sites

I'm using Windows 10.

I have the RPC service running, I've done this instruction:

Quote

 

Method 1:

The RPC (Remote Procedure Call) service in Services should be started and the startup type should be set to Automatic.

Steps:

a. Press Windows key + R.

b. Type services.msc

c. In the Services window, find Remote Procedure Call and right click on it to select Properties.

d. Under the General tab make sure the Startup type is Automatic and the Service status says Started.

 

I will try do the same on a different computer to see if if works.

Link to post
Share on other sites

Interestingly on the other computer the code is working without any errors and it result of showing 2 forms.

I'm not sure what setting on the first computer is preventing from working.

I've done pretty everything that was linked here:

36 minutes ago, Luke94 said:

A few more solutions here.

I'm having the Symantec Endpoint Protection, but I've turned that off, and it's still the same. The services are working normally...

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

    No registered users viewing this page.

×
×
  • Create New...