Jump to content

_IEFormGetObjByName, cannot find $sName


Recommended Posts

Hi All,

I am very new to AutoIt and scripting in general and have a question about IEFormGetObjByName. The help function says:
_IEFormGetObjByName ( ByRef $oObject, $sName [, $iIndex = 0] )
But how do I find what to enter for $sName? In the example below, it says that it can be found by viewing the HTML source. So I went to the google home page, clicked Ctrl U to view the source, and cant figure out how they determined that the $sName is 'gbqf'. Can someone explain this process to me? Thanks in advance!

; Get a reference to a specific form by name.  In this case, submit a query
; to the Google search engine.  Note that the names of the form and form
; elements can be found by viewing the page HTML source

#include <IE.au3>

Local $oIE = _IECreate("http://www.google.com")
Local $oForm = _IEFormGetObjByName($oIE, "gbqf")
Local $oQuery = _IEFormElementGetObjByName($oForm, "q")
_IEFormElementSetValue($oQuery, "AutoIt IE.au3")
_IEFormSubmit($oForm)
 

Link to comment
Share on other sites

I tend to use Chrome personally because it shows me the parent elements here are my steps:

Open: Google in Chrome
Click: Inside the Search field
Press: Ctrl+Shift+I

Or

Press F12 to go to the Developers console
Get the "name" (This is whats used in the $oQuery example)
Click: the Parent form element
Get the "name" (This is whats used in the $oForm note this can differ to the one in AutoIt help)

Here are some screenshots of the process

Google_Elements01.jpg

Google_Elements02.jpg

Link to comment
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
 Share

×
×
  • Create New...