Sign in to follow this  
Followers 0
Bodi

Impossible button click in IE

6 posts in this topic

This button is not in a form which so far made it impossible for me to click it (without using the mouse !).

An impossible task for _IE or just something simple I'm overlooking ?

#include <IE.au3>

$Results = '<input value="Greetings" type="button" onclick="java script:alert(''Hi there !'')">'

$oIE = _IECreate ()

_IEDocWriteHTML ($oIE, $Results)

_IEAction ($oIE, "refresh")

; This followed by FormElementGetObjByName won't work as there are 0 forms on this page

$oForms = _IEFormGetCollection ($oIE)

; This won't work either, RC=7 InvalidDataType

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

_IEAction ($oSubmit, "click")

; This won't work, also RC=7 InvalidDataType

_IEImgClick ($oIE, "AutoItImage", "Greetings")

Share this post


Link to post
Share on other sites



; This won't work either, RC=7 InvalidDataType

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

_IEAction ($oSubmit, "click")

Give your input a name or id attribute eg.

$Results = '<input id="greetings" value="Greetings" type="button" onclick="java script:alert(''Hi there !'')">'

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

$oEvent2 = ObjEvent( $oSubmit, "openButton_")

func openButton()

.....

endfunc

Share this post


Link to post
Share on other sites

The script you posted works, try rewriting your javascript call though:

$Results = "<input name='Greetings' value='Greetings' type='button' onclick='alert(""Hi there !"");'>"

Share this post


Link to post
Share on other sites

The script you posted works, try rewriting your javascript call though:

$Results = "<input name='Greetings' value='Greetings' type='button' onclick='alert(""Hi there !"");'>"

Will thanks for the hints but as it's not my HTML I'm trying to access please assume I can't change it.

This is what makes it so difficult !

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

__IETagNameGetCollection

Edited by Will66

Share this post


Link to post
Share on other sites

__IETagNameGetCollection

Will, super ! Did the trick. Thanks !

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