Jump to content

Can't click a button in IE


Recommended Posts

Dear Colleagues,

 

All I need is to click a button with "Close" value - the problem is that it shows up later in the middle of some processing (Actually it's a one button, first with "Cancel" text and then it changes to "Close")... I tried multiple functions without a good result.

Here is the code from the website (from view source):

</SCRIPT>
         
<P align="center" style="padding: 5px;"><INPUT name="ctl00$bodyPlaceholder$btnCancelarProcessamento" class="button" id="bodyPlaceholder_btnCancelarProcessamento" onclick="CancelarProcessamento();return false;" type="submit" value="Cancel"> 
             <INPUT name="ctl00$bodyPlaceholder$btnFecharProcessamento" class="button" id="bodyPlaceholder_btnFecharProcessamento" onclick="FecharJanelaProcessamento();return false;" type="submit" value="Close"> 
        </P></DIV><SPAN class="error" id="lblError"></SPAN>         </DIV><BR>
<HR style="color: rgb(204, 204, 204);">

I have no problem with all of the  other buttons which are static on the page. Only with that one!

Here is my loop:

Global $oClose = _IEGetObjByName ($oIE, "ct100$bodyPlaceholder$btnFecharProcessamento")

Local $i = 0
While $i <> 1
If String($oClose.type) = "submit" And String($oClose.value) = "Close" Then  
$i =1
_IEAction ($oClose, "focus")
_IEAction ($oClose, "click")
Sleep ( 3000 )
EndIf
WEnd
EndFunc

This is the output I received by using _IETagNameAllGetCollection for "Cancel":

TAGNAME: INPUT
id: bodyPlaceholder_btnCancelarProcessamento
inner text:

And this for "Close":

TAGNAME: INPUT
id: bodyPlaceholder_btnFecharProcessamento
inner text:

So will this works? (Won't be able to check in few hours)

Local $oInputs = _IETagNameGetCollection($oIE, "input")
For $oInput In $oInputs
    If $oInput.type = "submit" And $oInput.value == "Close" Then 
    _IEAction ($oInput, "click")
Next

If the loop is correct... Could you please help me with putting it into the WHILE loop I posted before?

 

I will really appreciate your help!

Thank you in advance.

Edited by Patryk
new info
Link to post
Share on other sites
7 minutes ago, Valuater said:

Just a quick look...

$oClose = _IEGetObjByName ($oIE, "ct100$bodyPlaceholder$btnFecharProcessamento")

should be in the loop... that way the name will change and you will get the correct results..

8)

Hello @Valuater!

 

Could you please help me with constructing the loop? I am not sure how to put this into the loop... Thanks!

 

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

    No registered users viewing this page.

×
×
  • Create New...