scttech1967 Posted September 15, 2017 Share Posted September 15, 2017 How do I click on the "Find" button on a web page that doesn't have an ID? See code & html below. Any help appreciated. ; code doesn't find & click the button $oButtons = _IEFormElementGetCollection($oIE, "button") For $oButton in $oButtons If String($oButton.value) = "Find" Then _IEAction($oButton, "click") EndIf Next Code from the web page <form id="latlongform"> <label for="gadres">Place Name</label> <input id="gadres" type="text" placeholder="Type a place name" class="width70" required /> <button title="Find Lat & Long" class="button">Find</button><br /> <small>Add the country code for better results. Ex: London, UK</small> </form> Link to comment Share on other sites More sharing options...
Danp2 Posted September 15, 2017 Share Posted September 15, 2017 Since it's the only button in the form, you could try _IEFormSubmit() Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
BigDaddyO Posted September 15, 2017 Share Posted September 15, 2017 Try if $oButton.outertext = "file" then Link to comment Share on other sites More sharing options...
Danp2 Posted September 15, 2017 Share Posted September 15, 2017 15 minutes ago, BigDaddyO said: Try if $oButton.outertext = "file" then Think you meant innertext, right? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
BigDaddyO Posted September 15, 2017 Share Posted September 15, 2017 nope, I meant outertext. Though looking closer, the _IEFormElementGetCollection in the OP isn't being use properly. Typically I use _IETagNameGetCollection when working with web pages. Not sure if this will work as is, but I'd do something like $oTAGs = _IETagNameGetCollection($oIE, "button") For $oTag in $oTAGs If $oTAG.className = "button" Then If $oTAG.outertext = "Find" Then _IEAction($oTAG, "click") ExitLoop EndIf EndIf Next Link to comment Share on other sites More sharing options...
Danp2 Posted September 15, 2017 Share Posted September 15, 2017 33 minutes ago, BigDaddyO said: nope, I meant outertext Ok... looks like they return the same value in this case. Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
scttech1967 Posted September 16, 2017 Author Share Posted September 16, 2017 Thanks @BigDaddyO - your suggestion answered my question & made my day!! 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