Jump to content

Clicking text (connected to javascript)


bundyxc
 Share

Recommended Posts

I'm automating a web task, and need to click this:

<button class="action" tabindex="503">Update</button>

As you can see, it isn't a link, it doesn't have an ID, or a name. Any ideas on how to click it?

Global $arr[2]

$arr[0]="hip"
$arr[1]="hip"
;^^ hip hip array. ^^
Link to comment
Share on other sites

Look at the _IE* functions in the help file. You can get the collection of buttons by _IETagNameGetCollection($oForm, "button") and then loop through the collection looking for $oButton.tabIndex = 503 and/or $oButton.innerText = "Update". Once you find it, you would click it with _IEAction($oButton, "click").

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Alright, so how would I loop through the collection?

$update_submit = _IETagNameGetCollection ($browser, "button")
_IEAction($update_submit,"click")

Throws this error:

C:\Program Files\AutoIt3\Include\IE.au3 (2795) : ==> The requested action with this object has failed.:
$o_object.Click()
$o_object.Click()^ ERROR
>Exit code: 1    Time: 11.027
Global $arr[2]

$arr[0]="hip"
$arr[1]="hip"
;^^ hip hip array. ^^
Link to comment
Share on other sites

Alright, so how would I loop through the collection?

$update_submit = _IETagNameGetCollection ($browser, "button")
_IEAction($update_submit,"click")

Throws this error:

C:\Program Files\AutoIt3\Include\IE.au3 (2795) : ==> The requested action with this object has failed.:
$o_object.Click()
$o_object.Click()^ ERROR
>Exit code: 1    Time: 11.027
Look at the example script under _IETagNameGetCollection() in the help file. Notice the For/In/Next loop for walking through the collection one object at a time ($oInput in the example). In your loop, you want to test each one until you find the right one (as I described earlier), then do your "click" and exit the loop.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...