Jump to content
DaveOLW

Control of Internet Explorer

Recommended Posts

Hi have not used  Autoit before on Internet Explorer, have got it open web page where there is search box with the usual "magnifier" (button) to click to start searching. Using the Inspect tool it does not give a Name for the form or for the "magnifier" (button).  How do I get the Names? 

Share this post


Link to post
Share on other sites
21 hours ago, Nine said:

Look at IE UDF in help file.  Everything you need is in there.

Yes have read through that several times. Have found the form name and search box names and can load page insert text into search box and send enter so it opens a list of songs I have searched for to select, but cannot select them.  Cannot find the name of the table or the buttons inside the cells?   Focus remains on search box and cannot get it go to Button "Report Song".

This is the section of HTML code:-

<table id="searchResults" class="twelve "><tbody><tr><td ><div id="song-c91404de-bef4-4893-ac4b-4bbe51b81a1b" class="searchResultsSongSummary"><div class="row"><div class="one mobile-one reportAction columns" style="margin-right: 1em;"><span onclick="toggle('c91404de-bef4-4893-ac4b-4bbe51b81a1b'); ga('send','event', 'Add CCL Activity', 'Select', 'Report Song button in Search Results');" class="c91404de-bef4-4893-ac4b-4bbe51b81a1b button blue-dark small reportExpandButton" style="display: inline-block;">Report Song </span><span  style="display: none;" class="button small gray-light-2 reportInactiveButton">Report Song</span></div>

There is Table id "searchResults" but no name using id does not work, have tried   -   $oTableOne = _IETableGetObjByName($oForm, "searchResultsSongSummary").  "Report Song" button does not have a name, have tried    -   Local $oQuery = _IEGetObjByName($oForm, 'Repot Song')

1503086816_reportsong.jpg.c140e1e9c9e11a6f00924f785659bb2d.jpg

My code so far:_           Focus remains on search box and cannot get it go to Button "Report Song".

#include <IE.au3>
Local $oIE = _IECreate("https://olr.ccli.com/search/results?SearchTerm=")
_IELoadWait($oIE)
Local $oForm = _IEFormGetObjByName($oIE, 'frmSearchTerm')
Local $oQuery = _IEGetObjByName($oForm, 'SearchTerm')

_IEFormElementSetValue($oQuery, 'Once Again')
Local $hWnd = _IEPropertyGet($oIE, "hwnd")
ControlSend($hWnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}")

Local $oSubmit = _IEFormElementGetObjByName($oForm, 'Report Song')
_IEAction($oSubmit, "click")

Have tried using focus in last line, using enter but that did not work.

Any help anyone can give me would be appreciated, thanks.

David 

 

Share this post


Link to post
Share on other sites

"Report Song" is an innerText.  So you could use something like :

$colSpan = _IETagNameGetCollection ( $oForm, "span")
For $span in $colSpan
  If $span.innertext = "Report Song" then $span.click ()
Next

Try with $oForm or $oIE, try also with index on collection, not sure which one is best to click on (first or second)

Share this post


Link to post
Share on other sites

Thanks for the reply.

Tried this with $oForm and it comes up with Error "Variable must be of Type "Object"

Tried with $oIE   with collection and collection with index, it does nothing,

tried with $oForm  and collection with index, does nothing.

David

Share this post


Link to post
Share on other sites
3 minutes ago, DaveOLW said:

Tried this with $oForm and it comes up with Error "Variable must be of Type "Object"

Well, it should have gave you the same error in your code.  Did you try only my few lines ?  Cause it needs the rest of your code before !

Share this post


Link to post
Share on other sites
#include <IE.au3>

Local $oIE = _IECreate("https://olr.ccli.com/search/results?SearchTerm=")
_IELoadWait($oIE)

Local $oForm = _IEFormGetObjByName($oIE, 'frmSearchTerm')
Local $oQuery = _IEGetObjByName($oForm, 'SearchTerm')

_IEFormElementSetValue($oQuery, 'Once Again')

Local $hWnd = _IEPropertyGet($oIE, "hwnd")
ControlSend($hWnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}")
Sleep(2000)



$colSpan = _IETagNameGetCollection($oForm, "span")
For $span in $colSpan
  If $span.innertext = "Report Song" then $span.click ()
Next

error4.jpg.aa92d1823ab5f7f4f0042d649645c970.jpg

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

×
×
  • Create New...