Jump to content

Clicking on a javascript button


Recommended Posts

Ok, So I've used autoit here and there over the past two years, but I get confused when looking even at the help file or at other exmples for things like the IEAction.

I'm trying to get autoit to click on a button which uses javascript in the page.

This is the info about the button :

<input type="button" onclick="return SubmitTheForm();" value="Continue" name="mybutton">

What do I enter into my autoit script to click on that button no matter where it appears on the screen?

Sorry, I know this must seem like a simple question but I can't figure out what to put in.

Also, I'm confused by the example saying:

#include <IE.au3>

$oIE = _IE_Example ("form")

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

_IEAction ($oSubmit, "click")

_IELoadWait ($oIE)

Should _IE_Example be replaced by my Title of my browser page? What else changes to what?

uhh, any help would be great.

Thanks.

Link to comment
Share on other sites

ok, so now i've done this:

WinWaitActive("[CLASS:IEFrame]")

#include <IE.au3>

$oIE = _IEAttach ("FIPPA Notice - Windows Internet Explorer")

$oForm = _IEGetObjByName ($oiE, "mybutton")

_IEAction ($oForm, "click")

But now it tells me that :

--> IE.au3 V2.4-0 Warning from function _IEAttach, $_IEStatus_NoMatch

--> 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: 2.532

Link to comment
Share on other sites

ok, so aside from the question above of why I can't use the title of the page in ieattach properly, i did figure out how to click the button on the existing page. but now i have another javascript question:

There is a new list of javascript items, and the item I want to click on does not have a simple name like the one above which had "mybutton"

Here is the info on the list item:

<TR><TD VALIGN="TOP" CLASS="x12"><LI><A STYLE="text-decoration:none;color: #800000;font: 10pt Helvetica Condensed; font-weight: bold;" href="javascript:void(0)" onclick="submitFormWin('H002','MW1','mugsi')">SOLAR

and other tabel/list options also have a class of "x12"

Link to comment
Share on other sites

Yes!

I got it to work with the ieclickbyindex!

So glad I got it working, and although I didn't get any replies here, it actually helped to post here and think it out. Plus all the other examples on the site helped too.

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