Jump to content

IE.au3 Click submit button without name or id ?


Go to solution Solved by karlkar,

Recommended Posts

Posted
Hi Autoit Forum ,
I want to learn how to click a submit  in this case
 
<a class="btn-yellow bby-submitPlaceOrder" onClick="handlePlaceOrder()">Place Order</a>
Thanks ..
Posted

Actually you don't have to click it. You can just call this function from onClick.

$oIe.document.parentWindow.eval("handlePlaceOrder()")

 

I got this error when try it:

C:\Users\Dat\Desktop\WORK\DAT - POST.au3 (399) : ==> The requested action with this object has failed.:
$OIE.document.parentWindow.eval("handlePlaceOrder()")
$OIE.document.parentWindow.eval("handlePlaceOrder()")^ ERROR
->03:05:32 AutoIt3.exe ended.rc:1
>Exit code: 1    Time: 23.228
  • Solution
Posted

Are you using ie 10?

Try

$links = $oIe.document.getElementsByClassName("btn-yellow bby-submitPlaceOrder")

For $link In $links

$link.click()

Next

You can of course change this loop if you know which occureance of this link you want to click to

$links.item(x).click()

Posted

Are you using ie 10?

Try

$links = $oIe.document.getElementsByClassName("btn-yellow bby-submitPlaceOrder")

For $link In $links

$link.click()

Next

You can of course change this loop if you know which occureance of this link you want to click to

$links.item(x).click()

 

This one working perfectly ! Thank you very very much ! You are a hero save my life !

2 more question, i dont know why all of my script CAN'T RUN on Windows Server 2008 with IE 11 ?  Where I can find documents to about $oIe.document."something" ?

Thanks again and have a great day !

Posted

I am trying to do the same thing, press a button on a web page using autoit.  The line of code  describing the button I am trying to press is shown below:

<TR><TD colspan=6 align=center><br><input type="button" value="Copy Your Computer's Time Settings" onclick="CopyTimeFromPC();"></TD></tr>

The web page has HTML and embedded javascript.  I can see the onclick javascript subroutine in the web page source code.  I just don't know how to activate it.

All the ieau3 functions seem to need a name or class, this has neither.

Any ideas?

Posted

You can try either my answer from post #2 or

$inputs = $oIE.document.getElementsByTagName("input")

For $input In $inputs

If $input.value == "Copy Your Computer's Time Settings" then

$input.click()

EndIf

Next

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
×
×
  • Create New...