scttech1967

Unsuccessful with getting text on web page by ID

3 posts in this topic

Forgive me for being a total noob on my AutoIT skills, but I'm having a heck of a time retrieving the text from a web page text box. See code & html below. Any help appreciated.

; Code doesn't find & display
Local $oIE = _IECreate("http://www.latlong.net")
$oDiv = _IEGetObjByName ($oIE, "lat")
MsgBox($MB_SYSTEMMODAL, "Form Element Value", $oText)


Code from web page
<div class="col-6 m2">
<label for="lat">Latitude</label>
<input type="text" name="lat" id="lat" placeholder="lat coordinate" />
</div>

Share this post


Link to post
Share on other sites



You retrieved an input element, but you never retrieve any values ($oText is unassigned). Also I see issues with using _IEGetObjByName instead of _IEGetObjById (this input element doesn't have a name).

Try --

Local $oIE = _IECreate("http://www.latlong.net")
$oLat = _IEGetObjById($oIE, "lat")
MsgBox($MB_SYSTEMMODAL, "Form Element Value", $oLat.value)

 

Share this post


Link to post
Share on other sites

I can't believe I missed that! Seems that I tried every variation and had the return value in the message box. Thank you @Danp2 !!

Share this post


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