Jump to content

Impossible button click in IE


Recommended Posts

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")

Link to comment
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

Link to comment
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 !

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...