Jump to content
Sign in to follow this  
anyday

Ie Pop Up Username Password Box

Recommended Posts

anyday

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

Share this post


Link to post
Share on other sites
Andrew Sparkes

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.

Share this post


Link to post
Share on other sites
anyday

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?

Share this post


Link to post
Share on other sites
Andrew Sparkes

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.

Share this post


Link to post
Share on other sites
anyday

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.

Share this post


Link to post
Share on other sites
seandisanti

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.

Share this post


Link to post
Share on other sites
vaibhavs

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

Share this post


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
Sign in to follow this  

×