scttech1967 Posted September 15, 2017 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>
Danp2 Posted September 15, 2017 Posted September 15, 2017 Since it's the only button in the form, you could try _IEFormSubmit() Latest Webdriver UDF Release Webdriver Wiki FAQs
BigDaddyO Posted September 15, 2017 Posted September 15, 2017 Try if $oButton.outertext = "file" then
Danp2 Posted September 15, 2017 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
BigDaddyO Posted September 15, 2017 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
Danp2 Posted September 15, 2017 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
scttech1967 Posted September 16, 2017 Author Posted September 16, 2017 Thanks @BigDaddyO - your suggestion answered my question & made my day!!
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