Jump to content
Sign in to follow this  

One Tough Button To Click

Recommended Posts

I have one button that I cannot figure out how to click. I had to resort to Send() for tabbing and pressing enter. Before I stamp the program as done, I thought I'd run it by you guys here.

The button source is: <INPUT TYPE="button" VALUE="Flush cache" onclick="flushCache();submitCache(this.form)" />

I've tried:

_IELinkClickByText($oIE, "Flush cache") = NoMatch

$oSubmit = _IEGetObjByName($oIE, "Flush cache") = NoMatch

Also, _IELinkClickByIndex didn't work, it either fired other buttons or returned NoMatch.

Anyone have something in their bag of tricks for this?


Share this post

Link to post
Share on other sites

Did you include the required IE.au3 file? There are a lot of return error codes for that function _IELinkClickByText(). Set up your script to do the error checking, and then post your code enclosing it with the code tags or autoit tags, which are like html only you use backets "[" and "]" instead of "<" and ">".

Share this post

Link to post
Share on other sites

Yes, IE.au3 is included. This code is part of a larger script that runs thru and clicks all the links in a web app for the purpose of recaching all the pages. And the code I tried is what's in the original post . . . it's all coming back NoMatch.

Now I'm finding that I can't rely on the tabbing either as it depends on who's running the script and what toolbar they might have .... the number of tabs needed to land on the Flush cache button can be different.

So is there any way anyone has to click on a button like this: <INPUT TYPE="button" VALUE="Flush cache" onclick="flushCache();submitCache(this.form)" />


Share this post

Link to post
Share on other sites

Well I finally figured it out. Here's the code.

$oForm = _IEFormGetCollection($oIE, 0)

$oFormElem = _IEFormElementGetCollection($oForm)

$iNumElements = @extended

For $i = 0 to $iNumElements - 1

$oElement = _IEFormElementGetCollection($oForm, $i)

$iElementProperty = _IEPropertyGet($oElement, "outerhtml")

If StringInStr($iElementProperty, "onclick=flushCache()") Then

_IEAction($oElement, "click")




In this case, "outerhtml" was the only property that returned anything useful.

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  

  • Create New...