phamtua Posted June 9, 2018 Share Posted June 9, 2018 Hi all, please help me click to this button with IE of AutoIT Code: <button type="button" class="btn btn-success">Convert</button> My code: #include <IE.au3> Local $oButtons = _IETagNameGetCollection($oIE, "button") Local $sTxt = "" For $oButton In $oButtons $sTxt &= $oButton.type & @CRLF Next If $sTxt == "button" Then _IEAction ($sTxt, "click") Cheers! Link to comment Share on other sites More sharing options...
Subz Posted June 9, 2018 Share Posted June 9, 2018 Try something like: #include <IE.au3> Local $oButtons = _IETagNameGetCollection($oIE, "button") For $oButton In $oButtons If $oButton.classname = "btn btn-success" Then _IEAction($oButton, "click") ExitLoop EndIf ;~ Or you could use InnerText If $oButton.InnerText = "Convert" Then _IEAction($oButton, "click") ExitLoop EndIf Next Link to comment Share on other sites More sharing options...
phamtua Posted June 9, 2018 Author Share Posted June 9, 2018 Worked, thanks! Link to comment Share on other sites More sharing options...
phamtua Posted June 9, 2018 Author Share Posted June 9, 2018 @Subz If in a HTML Code, there are two buttons, how can I click it P/s: $oButton.classname has two values! Link to comment Share on other sites More sharing options...
Subz Posted June 9, 2018 Share Posted June 9, 2018 Do they both have the same inner text? If not just use the second piece of code I posted in the example above which used InnerText property. Link to comment Share on other sites More sharing options...
phamtua Posted June 9, 2018 Author Share Posted June 9, 2018 No, there are 2 buttons in a web, therefore $oButton.classname <> "btn btn-success" Link to comment Share on other sites More sharing options...
Subz Posted June 9, 2018 Share Posted June 9, 2018 Not sure you understand my previous question, do both buttons say "Convert" or are they different? If they are different then you can just use: #include <IE.au3> Local $oButtons = _IETagNameGetCollection($oIE, "button") For $oButton In $oButtons If $oButton.InnerText = "Convert" Then _IEAction($oButton, "click") ExitLoop EndIf Next Link to comment Share on other sites More sharing options...
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