Patryk Posted September 22, 2017 Posted September 22, 2017 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!
Danp2 Posted September 22, 2017 Posted September 22, 2017 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. Latest Webdriver UDF Release Webdriver Wiki FAQs
Patryk Posted September 22, 2017 Author Posted September 22, 2017 @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!
Danp2 Posted September 22, 2017 Posted September 22, 2017 You could try checking the value of $oBtn.style.display Latest Webdriver UDF Release Webdriver Wiki FAQs
Danp2 Posted September 26, 2017 Posted September 26, 2017 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? Latest Webdriver UDF Release Webdriver Wiki FAQs
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now