Sign in to follow this  
Followers 0
elads

Click on object (IE)

8 posts in this topic

#1 ·  Posted (edited)

Hey,

I would like to click on a button after i'm logged to my system (web).

Here's the scenrario:

$oIE = _IECreate("http://www.somesite.com")

$oform = _IEFormGetObjByName($oIE, "start-login-form")
$ologin = _IEFormElementGetObjByName($oform, "Email") ; Email
$opassword = _IEFormElementGetObjByName($oform, "Passwd") ; Passwd

_IEFormElementSetValue($ologin, $sUsername)
_IEFormElementSetValue($opassword, $sPassword)
_IEFormSubmit($oform)

So far so good...

Now after i've logged in, I want to click on a button/link on that page.

What's the right command and how do i use it?

Thanks

Edited by elads

Share this post


Link to post
Share on other sites



Hey,

I would like to click on a button after i'm logged to my system (web).

Here's the scenrario:

$oIE = _IECreate("http://www.somesite.com")

$oform = _IEFormGetObjByName($oIE, "start-login-form")
$ologin = _IEFormElementGetObjByName($oform, "Email") ; Email
$opassword = _IEFormElementGetObjByName($oform, "Passwd") ; Passwd

_IEFormElementSetValue($ologin, $sUsername)
_IEFormElementSetValue($opassword, $sPassword)
_IEFormSubmit($oform)

So far so good...

Now after i've logged in, I want to click on a button/link on that page.

What's the right command and how do i use it?

Thanks

After you read the help file (You did read the help file, right?), and you tried the example scripts for the _IE* functions (You did try the examples, right?), what did you finally test and how it turn out?

:D


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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

After you read the help file (You did read the help file, right?), and you tried the example scripts for the _IE* functions (You did try the examples, right?), what did you finally test and how it turn out?

:D

Yes I did...

tried this right after:

_IEGetObjByName ($oButton, "button I want to click on")
_IEAction ($oButton, "click")

"button I want to click on" is a button that appears in that web page that opens, and that's what I want to click on...

As for the outcome, the page opens ok and the sign-in part is good. but after that nothing happens

Edited by elads

Share this post


Link to post
Share on other sites

And what does the SciTe output say?

Nothing.. the script is paused and that's it

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I don't think the part that you think you have problems with is actually the problem. It's more like that a few lines of code just before it are causing trouble.

These two functions: _IEGetObjByName and _IEAction are almost instant. There is no waiting inside, or anything.

Let me demonstrate by giving some bad input into them:

#include <IE.au3>

$oButton = "NOT AN OBJECT"

_IEGetObjByName ($oButton, "button I want to click on")
_IEAction ($oButton, "click")

Result:

>"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Users\Jos\Desktop\lol.au3"    
--> IE.au3 V2.4-0 Error from function _IEGetObjByName, $_IEStatus_InvalidDataType
--> IE.au3 V2.4-0 Error from function _IEAction, $_IEStatus_InvalidDataType
>Exit code: 0    Time: 0.209
Edited by Manadar

Share this post


Link to post
Share on other sites

Yes I did...

tried this right after:

_IEGetObjByName ($oButton, "button I want to click on")
_IEAction ($oButton, "click")

"button I want to click on" is a button that appears in that web page that opens, and that's what I want to click on...

As for the outcome, the page opens ok and the sign-in part is good. but after that nothing happens

Look again at _IEGetObjbyName() in the help file. The first parameter is $oIE or $oForm, etc., the PARENT object that has the one you are looking for under it. The second parameter is the button name (or ID, which is more reliable) in the HTML. So that should look more like:
$oButton = _IEGetObjByName($oIE, "ButtonName")
_IEAction($oButton, "click")

:D


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

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  
Followers 0