Jump to content
elads

Click on object (IE)

Recommended Posts

elads

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
PsaltyDS

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
elads

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
elads

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
jvanegmond

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
PsaltyDS

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
jvanegmond

I am giving some additional help through PM. There was some confidential information in his code, so he wanted to do it in private.

Share this post


Link to post
Share on other sites
tonycst

I too have this problem but not with the button.

I am trying to click inputbox.

$IE = _IEAttach($AssemblyWindow)
$PageLoadDone = _IELoadWait($IE)
$IEObject = _IEGetObjByname($IE, "txtSearch")
_IEAction($IEObject, "click")

Nothing happens unless i click it with mouse.

It ONLY works for buttons but not for a=inputs and combo boxes.
Maybe inputs and combos i try to click are none standard ?

 

<INPUT onkeypress=ValidationForCatalogandInventoryText();CheckScan(); onkeyup=EnableSearchButton(); onfocus=RemoveScanText(this.id); onblur=SystemSettingsTrim();SetScanText(false); id=txtSearch class=textbox onpaste=EnableSearchButton();OnPasteDisallowSpecialChars(); style="BACKGROUND-COLOR: white" ondrop="OnDragDropDisallowSpecialChars('btnSearch');" maxLength=15 value="Scan an item ..." name=txtSearch>

Thats where i want to click.

Edited by tonycst

Share this post


Link to post
Share on other sites
tonycst

8 years yet i landed here when i was searching for answers.
I think its best to keep adding to the thread VS creating new once containing same information over and over and over again, cluttering sql database.

 

But what do i know.

Ill do what you say.

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

×