Jump to content

Recommended Posts

Posted

Dear Colleagues,

Could you please help me with a following button? It changes it's value from 'Cancel' to 'Close' at the end of processing.

Here is the HTML code:

1) Value="Cancel"

<input name="ctl00$bodyPlaceholder$btnCancelarProcessamento" class="button" id="bodyPlaceholder_btnCancelarProcessamento" style="display: none;" onclick="CancelarProcessamento();return false;" type="submit" value="Cancel">

2) Value="Close"

<input name="ctl00$bodyPlaceholder$btnFecharProcessamento" class="button" id="bodyPlaceholder_btnFecharProcessamento" style="display: inline-block;" onclick="FecharJanelaProcessamento();return false;" type="submit" value="Close">

 

And here is my loop:

Sleep ( 3000 )
Func GetButtons()
$oButtons = _IEGetObjByName($oForm,"ctl00$bodyPlaceholder$btnFecharProcessamento",-1)
$i = 0
While $i <> 1
For $oBtn In $oButtons
    If _IEFormElementGetValue($oBtn) = "Close" Then
       $i = 1
        _IEAction($oBtn, "focus")
        _IEAction($oBtn, "click")
        ExitLoop
    EndIf
 Next
 WEnd
EndFunc

What is the problem? The problem is that after Sleep it clicks the button despite it had not changed it's value from "Cancel" to "Close"...

 

I will really appreciate if you could help me with this!

Posted

These appear to be two different buttons. Note the different names and IDs. It's likely that one is being hidden and then other shown at the time that the Close button appears.

Your code could just as easily been written as

$oBtn = _IEGetObjByName($oForm,"ctl00$bodyPlaceholder$btnFecharProcessamento")
_IEAction($oBtn, "focus")
_IEAction($oBtn, "click")

because that is what happens when you run it. You will need to loop and check the visibility of this button before continuing.

Posted

@Danp2 Thank you for your reply! The other problem is that I have no idea how to check the visibility. Is it easy to integrate it with my already written loop? Thank you in advance!

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...