Jump to content

One Tough Button To Click


JBJB
 Share

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?

Thanks!

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

Das Häschen benutzt Radar

Link to comment
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)" />

Thanks

Link to comment
Share on other sites

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

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

ExitLoop

EndIf

Next

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

Link to comment
Share on other sites

Great ! I'm not that experienced with objects. They used to be discouraging to me because they would always throw me errors. So I'm glad you were able to conquer this challenge.

Edited by Squirrely1

Das Häschen benutzt Radar

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