Sign in to follow this  
Followers 0
alinuzzu

IE button click (button has only value)

4 posts in this topic

Hello all,

I have the code:

<form method="post" name="table_form" action="blabla?action=submit">

<table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="table_label">Apply to all messages found:</td>

<td><input class="std_button" type="button" value="Delete" onclick="java script:return table_form_confirm_submit('Are you sure you want to Delete all selected items?','Delete');"></td>

<td><input class="std_button" type="button" value="Release" onclick="java script:return table_form_confirm_submit('Are you sure you want to Release all selected items?','Release');"></td>

</tr>

</table>

I want to click the Release button.

I tried with:

...

$oButton = _IEGetObjByName ($oForm, "Release")

_IEAction($oButton, "click")

...

but it does not work since the button Release has no Name or ID .

Do you have any solution on how to click Release button?

P.S. Form Submit does not work either.

Share this post


Link to post
Share on other sites



Hello all,

I have the code:

<form method="post" name="table_form" action="blabla?action=submit">

<table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="table_label">Apply to all messages found:</td>

<td><input class="std_button" type="button" value="Delete" onclick="java script:return table_form_confirm_submit('Are you sure you want to Delete all selected items?','Delete');"></td>

<td><input class="std_button" type="button" value="Release" onclick="java script:return table_form_confirm_submit('Are you sure you want to Release all selected items?','Release');"></td>

</tr>

</table>

I want to click the Release button.

I tried with:

...

$oButton = _IEGetObjByName ($oForm, "Release")

_IEAction($oButton, "click")

...

but it does not work since the button Release has no Name or ID .

Do you have any solution on how to click Release button?

P.S. Form Submit does not work either.

Get the collection of all "input" tags in that form with _IETagNameGetCollection(), and then loop through the collection until you find the one you want by _IEPropertyGet() looking for "innertext" of "Release":
#include <IE.au3>

; ...

$colTags = _IETagNameGetCollection($oForm, "input")
For $oTag In $colTags
; Might also work this way:
;   If $oTag.value = "Release" Then
    If _IEPropertyGet($oTag, "innertext") = "Release" Then
        _IEAction($oTag, "click")
    EndIf
Next

:)


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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Get the collection of all "input" tags in that form with _IETagNameGetCollection(), and then loop through the collection until you find the one you want by _IEPropertyGet() looking for "innertext" of "Release":

#include <IE.au3>

; ...

$colTags = _IETagNameGetCollection($oForm, "input")
For $oTag In $colTags
; Might also work this way:
;   If $oTag.value = "Release" Then
    If _IEPropertyGet($oTag, "innertext") = "Release" Then
        _IEAction($oTag, "click")
    EndIf
Next

:)

Thx for the reply. This works but now I got into another problem.

After I do the click a java script confirm window appears. (pop-up)

And want to click the OK button, but for some reason the script stops at that Pop up.

I tried the code below, but did not work. Script freezes and pop up window stays.

I also tried to Send("{ENTER}") with same result.

...

For $oInput In $oInputs

If $oInput.value == "Release" Then

_IEAction ($oInput, "click")

_IEPopUps()

ExitLoop

EndIf

Next

...

Func _IEPopUps()

Sleep( 3000 )

$tim = timerinit()

While 1

$windowtitle = WinGetTitle("", "")

Select

Case $windowtitle = "Security Alert"

WinActivate("Security Alert", "")

ControlClick("Security Alert", "", "Button1")

ExitLoop

Case $windowtitle = "Microsoft Internet Explorer"

WinActivate("Microsoft Internet Explorer", "Release")

ControlClick("Microsoft Internet Explorer", "Release", "Button1")

ExitLoop

EndSelect

If timerdiff($tim) > 60000 Then ExitLoop; <----- set the delay to whatever you need

WEnd

EndFunc

Any ideeas how to click that OK from Popup?

Edited by alinuzzu

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Thx for the reply. This works but now I got into another problem.

After I do the click a java script confirm window appears. (pop-up)

And want to click the OK button, but for some reason the script stops at that Pop up.

I tried the code below, but did not work. Script freezes and pop up window stays.

I also tried to Send("{ENTER}") with same result.

Any ideeas how to click that OK from Popup?

This happens because _IEAction() blocks the script until the page completes, but the page doesn't complete until the javascript (dialog box) is complete.

Look in the help file at example 2 under _IEAction() for an alternate method. You said you did Send("{ENTER}"), but did you just give focus to the control first or try to click it? If you tried to click it, the AutoIt script didn't continue to Send().

:)

Edited by PsaltyDS

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

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  
Followers 0