Jump to content

Click Web Pag Button to Login


Recommended Posts

I trying to load a web page, click a couple of button and then login. I have read the Help File and looked through the forums and come up with the following:

CODE
$URL = "192.168.10.25"

$oIE = _IECreate($URL)

$oQuery = _IEGetObjByName($oIE, "Continue")

_IEAction($oQuery, "click")

_IELoadWait($oIE)

; Will then new to figure out how to look for ok, yes, and then login

$o_form = _IEFormGetObjByName ($oIE, "f1")

$o_login = _IEFormElementGetObjByName ($o_form, "login")

$o_password = _IEFormElementGetObjByName ($o_form, "passwd")

$o_signin = _IEFormElementGetObjByName ($o_form, "SI")

$username = "me"

$password = "password"

_IEFormElementSetValue ($o_login, $username)

_IEFormElementSetValue ($o_password, $password)

_IEAction ($o_signin, "click")

This page opens the URL without any problem. I then get a page where I must click continue, followed by other pages where I need to click buttons. In reading the Help file it mentions a form. I assume the problem with the beginnings of my login script doesn't have the right form perhaps? Am I doing this correctly?

CC

Edited by IvanCodin
Link to comment
Share on other sites

I trying to load a web page, click a couple of button and then login. I have read the Help File and looked through the forums and come up with the following:

CODE
$URL = "192.168.10.25"

$oIE = _IECreate($URL)

$oQuery = _IEGetObjByName($oIE, "Continue")

_IEAction($oQuery, "click")

_IELoadWait($oIE)

; Will then new to figure out how to look for ok, yes, and then login

$o_form = _IEFormGetObjByName ($oIE, "f1")

$o_login = _IEFormElementGetObjByName ($o_form, "login")

$o_password = _IEFormElementGetObjByName ($o_form, "passwd")

$o_signin = _IEFormElementGetObjByName ($o_form, "SI")

$username = "me"

$password = "password"

_IEFormElementSetValue ($o_login, $username)

_IEFormElementSetValue ($o_password, $password)

_IEAction ($o_signin, "click")

This page opens the URL without any problem. I then get a page where I must click continue, followed by other pages where I need to click buttons. In reading the Help file it mentions a form. I assume the problem with the beginnings of my login script doesn't have the right form perhaps? Am I doing this correctly?

CC

Look at the examples for _IEAction() and read the comments (especially Example 2). Some forms require "focus" then ControlSend() an "{ENTER}", or something like that.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

I figured out the first part of my login script. I read through the Help File, got lucky and guessed correctly to get to the next portion of the login:

CODE
$URL = "192.168.10.25"

$oIE = _IECreate($URL)

_IELinkClickByIndex ($oIE, 0)

The next dialog box requires me to press OK the choose a certificate. The default focus is set on the OK button so I figured I would send an ENTER and move on to the next screen. If I do this manually I verified all I had to do was press enter to continue. I tired a couple of the methods show below and none worked.

CODE
$URL = "192.168.10.25"

$oIE = _IECreate($URL)

_IELinkClickByIndex ($oIE, 0)

sleep (1000)

Send("{ENTER}")

;sleep (1000)

;Send("{LEFT}") ; & "{ENTER}")

; I need to select ok then yes the login

I don't understand why if the dialog box has focus why the Send("{ENTER}"}) doesn't' work.. I read the Help File and see I may be able to use::

CODE
$oIE = _IE_Example ("form")

$oSubmit = _IEGetObjByName ($oIE, "submitExample")

_IEAction ($oSubmit, "click")

_IELoadWait ($oIE)

Would the dialog box be considered a form? If it is a form how do you figure out what the form name is?

CC

Link to comment
Share on other sites

The next dialog box requires me to press OK the choose a certificate. The default focus is set on the OK button so I figured I would send an ENTER and move on to the next screen. If I do this manually I verified all I had to do was press enter to continue. I tired a couple of the methods show below and none worked.

Would the dialog box be considered a form? If it is a form how do you figure out what the form name is?

CC

Many of the pop-ups triggered by an IE page are not themselves IE windows, just normal Win32 API dialogs, automated with the usual AutoIt stuff, like ControlSend(). Check out the window with AU3Info.exe to be sure.

After getting good identity info on the window, use ControlSend() on the window or ControlClick() on the OK button.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
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
 Share

  • Recently Browsing   0 members

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