Sign in to follow this  
Followers 0
Patryk

How to automate this IE button?

5 posts in this topic

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!

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

@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!

 

Share this post


Link to post
Share on other sites

You could try checking the value of $oBtn.style.display

Share this post


Link to post
Share on other sites
Quote

Could you please help me with checking  $oBtn.style.display ?

How to code this?

@Patryk Let's keep this in the public thread where others can benefit / participate, ok? ;-)

What have you tried since your last post?

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