Jump to content

Recommended Posts

Posted

Im making a script to naviagte to a website and enter username and password.

The problem im having is it will navigate to website but when the IE box pops up asking for username and pass it doesnt do anything.

here is my code.

#include <ie.au3>

$username = "username"

$password = "pass"

BlockInput (1)

$oIE = _IECreate()

WinSetState("about:blank - Microsoft Internet Explorer", "", @SW_MAXIMIZE)

_IENavigate($oIE, "https://website.com")

WinWaitActive ( "Connect to website.com", "&User name" )

ControlSetText ( "Connect to website.com", "&User name", "Edit2", $username )

ControlSetText ( "Connect to website.com", "&User name", "Edit3", $password )

ControlClick ( "Connect to website.com", "&User name", "Button2" )

BlockInput(0)

Exit

Posted (edited)

Instead of trying the Control...() Functions, try _IEForm...()

_IEFormGetObjByIndex()
    Obtain an object variable reference to a form by 0-based index
    
    _IEFormGetObjByName()
    Obtain an object variable reference to a form by name
    
    _IEFormElementGetObjByIndex()
    Obtain a object reference to a form element within a form by 0-based index
    
    _IEFormElementGetObjByName()
    Obtain a object reference to a form element within a form by name

    _IEFormElementGetValue()
    Get the value of a specifid form element
    
    _IEFormElementSetValue()
    Set the value of a specified form element
    
    _IEFormSubmit()
    Submit a specified form

Those should work for you. IE.au3 is a wonderful file.

Sparkes.

Edited by Andrew Sparkes

---Sparkes.

Posted

thanks for the info, but would _IEForm work if the login and pass is not actually a form on the website but a .htaccess type of pass where it asks before the site even loads?

Posted (edited)

I am not sure. I have never used it for .htaccess pages... If your code isn't working, double and triple check that you have the right params for the Control...() functions. Perhaps your could try ControlSend() ... That may work...

Other than that, I'm afraid I can't help you...

It would be a nice feature of the new build of IE.au3 to see it able to fix your problem...

Sparkes.

EDIT: Typo

Edited by Andrew Sparkes

---Sparkes.

Posted

just to let everyone who doesnt know already this is what i found out.

The _IENavigate function is set to wait till page loads completly before going to next line in script?

$f_wait - 1 = wait for page load to complete before returning

; - 0 = return immediately

well on the _IENavigate line i just set it this way

_IENavigate($oIE, "https://website.com", 0)

and after it went to webpage it automatically went to the winwaitactive line which was next in the script.

Posted

just to let everyone who doesnt know already this is what i found out.

The _IENavigate function is set to wait till page loads completly before going to next line in script?

$f_wait - 1 = wait for page load to complete before returning

; - 0 = return immediately

well on the _IENavigate line i just set it this way

_IENavigate($oIE, "https://website.com", 0)

and after it went to webpage it automatically went to the winwaitactive line which was next in the script.

good idea. thanks for posting the workaround.
  • 11 months later...
Posted

I am working on the same script as ANYDAY.

But I am facing a problem.

The website opens and the Username field is getting populated.

But the password box is not getting populated.

I have copy-pasted the exact code as suggested by ANYDAY and just modified the site parameters.

Any suggestions where should I look for problems.

No errors in sciTE editor.

Pls help.

thx

vai

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...