Jump to content

Unsuccessful with getting text on web page by ID

Recommended Posts

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" />

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)


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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...