Jump to content

Internet Explorer Automation UDF library


DaleHohm
 Share

Recommended Posts

I have read the previous post, but I am still confused on how to select a specific check box depending on the value next to it. I have never worked with COM, so I am really confused. Is there a certain function which I should be looking at. Your help would be greatly appreciated. I read that someone was trying to select checkboxs depending on a value, but there was no code to lead me in the right direction.

Also, I do not have any code which I can post. So far I have navigated to the correct webpage, but now I can hung up on getting the correct check box selected.

Thank you in advance.

Link to comment
Share on other sites

I have read the previous post, but I am still confused on how to select a specific check box depending on the value next to it. I have never worked with COM, so I am really confused. Is there a certain function which I should be looking at. Your help would be greatly appreciated. I read that someone was trying to select checkboxs depending on a value, but there was no code to lead me in the right direction.

Also, I do not have any code which I can post. So far I have navigated to the correct webpage, but now I can hung up on getting the correct check box selected.

Thank you in advance.

Can you post a small example of the HTML Code of the page you want to control?

I'm sorry. in 30 Minutes my weekend starts and I will be off-screen. Maybe somone will read your HTML-Example and help you, or I will when I'm back at my Desk (probably tomorrow).

Say: "Chuchichäschtli"My UDFs:_PrintImage UDF_WinAnimate UDFGruess Raindancer
Link to comment
Share on other sites

I copied the source into front page, and cliped out the checkboxes and values:

<td width="25"><img alt="" border="0" height="5" src="/img/1.gif" width="25"></td>

<td><div class="modulepad"><span class="bold">Tracking Number</span></div></td>

<td bgcolor="#ffffff"><img alt="" border="0" height="1" src="/img/1.gif" width="1"></td>

<td><div class="modulepad"><span class="bold">Package<br>Weight</span></div></td>

<td bgcolor="#ffffff"><img alt="" border="0" height="1" src="/img/1.gif" width="1"></td>

<td><div class="modulepad"><span class="bold">Package<br>Status</span></div></td>

</tr>

<tr>

<td><img alt="" border="0" height="5" src="/img/1.gif" width="1"></td>

<td><img alt="" border="0" height="5" src="/img/1.gif" width="1"></td>

<td bgcolor="#ffffff"><img alt="" border="0" height="5" src="/img/1.gif" width="1"></td>

<td><img alt="" border="0" height="5" src="/img/1.gif" width="1"></td>

<td bgcolor="#ffffff"><img alt="" border="0" height="5" src="/img/1.gif" width="1"></td>

<td><img alt="" border="0" height="5" src="/img/1.gif" width="1"></td>

</tr>

<!-- Begin even row -->

<tr bgcolor="#ffffff">

<td colspan="6"><img alt="" border="0" height="5" src="/img/1.gif" width="1"></td>

</tr>

<!-- End even row -->

<tr bgcolor="#ffffff">

<td colspan="6"><img alt="" border="0" height="5" src="/images/1.gif" width="1"></td>

</tr>

<tr bgcolor="#ffffff" valign="top">

<td><div class="modHeadPad"><input class="rad" name="voidNumber001" type="checkbox" value="1ZR3620A0310736809"></div></td>

<td colspan="2"><div class="modulepad">1ZR3620A0310736809</div></td>

<td colspan="2"><div class="modulepad">28.20</div></td>

<td colspan="1"><div class="modulepad">Delivered</div></td>

</tr>

<tr bgcolor="#ffffff">

<td colspan="6"><img alt="" border="0" height="5" src="/images/1.gif" width="1"></td>

</tr>

<tr>

<td colspan="6"><img alt="" border="0" height="5" src="/images/1.gif" width="1"></td>

</tr>

<tr valign="top">

<td><div class="modHeadPad"><input class="rad" name="voidNumber002" type="checkbox" value="1ZR3620A0310737586"></div></td>

<td colspan="2"><div class="modulepad">1ZR3620A0310737586</div></td>

<td colspan="2"><div class="modulepad">28.20</div></td>

<td colspan="1"><div class="modulepad">Delivered</div></td>

</tr>

<tr>

<td colspan="6"><img alt="" border="0" height="5" src="/images/1.gif" width="1"></td>

</tr>

<tr bgcolor="#ffffff">

<td colspan="6"><img alt="" border="0" height="5" src="/images/1.gif" width="1"></td>

</tr>

<tr bgcolor="#ffffff" valign="top">

<td><div class="modHeadPad"><input class="rad" name="voidNumber003" type="checkbox" value="1ZR3620A0310738076"></div></td>

<td colspan="2"><div class="modulepad">1ZR3620A0310738076</div></td>

<td colspan="2"><div class="modulepad">51.20</div></td>

<td colspan="1"><div class="modulepad">Billing<BR> Information<BR> Received</div></td>

</tr>

<tr bgcolor="#ffffff">

<td colspan="6"><img alt="" border="0" height="5" src="/images/1.gif" width="1"></td>

</tr>

<tr>

<td colspan="6"><img alt="" border="0" height="5" src="/images/1.gif" width="1"></td>

</tr>

<tr valign="top">

<td><div class="modHeadPad"><input class="rad" name="voidNumber004" type="checkbox" value="1ZR3620A0310742927"></div></td>

<td colspan="2"><div class="modulepad">1ZR3620A0310742927</div></td>

<td colspan="2"><div class="modulepad">1.50</div></td>

<td colspan="1"><div class="modulepad">Delivered</div></td>

</tr>

Edited by NSearch
Link to comment
Share on other sites

<table border="0" cellpadding="0" cellspacing="0" width="566">

<tr>

<td width="422">

<!-- Begin Content Area -->

<form method="post" action="confirm?loc=en_US">

<input type="hidden" name="clientID" value="">

<input type="hidden" name="packagelist" value="1ZR3620A0310736809,1ZR3620A0310737586,1ZR3620A0310738076,1ZR3620A0310742927,">

<input type="hidden" name="numberOfPackages" value="4">

<!--- Begin Table: Module Header (Parent:Formatting Table) --->

<table bgcolor="#996633" border="0" cellpadding="0" cellspacing="0" width="100%">

Tha Bad thing now is that the Form you want to adress doesn't hae a name atribute (... name = "formXY" ...) inside the <form ... > Tag...

Now you have to determine which Form on this Page it is, then you can get the Form Object with the _IEFormGetObjByIndex() function.

Then when you have that you can adress any element in this Form by Using _IEFormElementGetObjByName() function.

Now I have to leave... hope these Bits where enough for you...

Say: "Chuchichäschtli"My UDFs:_PrintImage UDF_WinAnimate UDFGruess Raindancer
Link to comment
Share on other sites

How do I do this, if the form tag does not have a name attribute? Is there a way around this?

Thanks.

Reply 37 to this post has a utility to help you figure this out. You can also use Mozilla Firefox and its built-in DOM Inspector to get the required detail on the webpage.

Dale

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Guest Omni1337

Humm, does the fact the webpage is based on PHP makes the UDF library/Internet Explorer unable to "see" properly the values?

Here is a bit of the php code of the page:

<TABLE cellpadding="0">
<FORM action="loginController.php" method="post" target="_top">
<INPUT type="hidden" name="sidvariable" value="ab2e81acd868d975aa758b13297e5fcc">
<TR>
<TD class="text8" align="right">Member No </TD>
<TD><INPUT type="text" name="userName" class="submit" size="20" maxlength="25" value=""></TD>
</TR>
<TR>
<TD class="text8" align="right">Password </TD>
<TD><INPUT type="password" name="password" class="submit" size="20" maxlength="10"></TD>
</TR>
<TR>
<TD colspan="2" class="text8" align="center">
<INPUT type="checkbox" value="yes" name="nameMem" >Remember username        </TD>
</TR>
<TR>
<TD class="text9"> </TD>
<TD><INPUT type="submit" class="appSubmit" value="Log in"></TD>
</TR>
</FORM>
</TABLE>

And here is one of the documents generated by the utility in post 37:

Elements for form 0
Object Type Object Count 
DispHTMLFormElement 5 

Element Characteristics
Index Tag Name Id Extra Information Object Type 
0 INPUT sidvariable   Form Input Type: hidden
Value: 0 DispHTMLInputElement 
1 INPUT userName   Form Input Type: text
Value: 0 DispHTMLInputElement 
2 INPUT password   Form Input Type: password
Value: 0 DispHTMLInputElement 
3 INPUT nameMem   Form Input Type: checkbox
Value: yes DispHTMLInputElement 
4 INPUT  Form Input Type: submit
Value: Log in DispHTMLInputElement

My problem is that it seems that my script can't either find the field/object for the username/password or it couldn't change it. I've tried using $o_username = _IEFormGetObjByName($oIE, "userName") , $o_username = _IEFormGetObjByIndex($oIE, 1) and $o_username = _IEFormGetObjByIndex($oIE, 162) (well, in one of the document Characteristics of all HTML Elements on page says that the username index is 162); followed by a _IEFormElementSetValue($o_username, "UserNameTest"). None of them changed the username field from blank to "UserNameTest". The same happens to the password field.

It is to note that I did not put the form name since I don't know what is it! At least I assumed that the form name "0" means that it is blank or there is no name.

Also, may I know where is the list of actions/commands that can performed on item() ? Since the following code worked for the submit button:

$o_all = _IETagNameAllGetCollection($oIE)
$o_all.item(173).click

And I sort of assume there are more actions that can be performed other than .click, but I have checked the Online Documentation part (the functions listing) and the UDF IE Automatic Library functions list, none of them talks about item($index) and the method performed on it .click.

Link to comment
Share on other sites

I have tried impossibly to glean info off virgilio.it with this udf, but it seems to not be able to!

Try hard as a i may to get the Ie.au3 (and some code obviously) to click the link on this page.

http://mio.discoremoto.virgilio.it/frrr/Hero%20CHINA/H01.JPG

When I tried the utility (post 37) it gave nearly 0 info when you can clearly see there are several links and imgs. Quite curious...

Is it some bug on the site? Or is it due to the 'foreign language'? Or mayhaps a bug in the UDF/site combination...

Any ideas?

just..need...to click the scarica..... Urgh... ;)

Link to comment
Share on other sites

Earlier I noted that web page dialogs don't show up under the shellwindows collection so they can't be easily accessed.

There are ways to get an IHTMLDocument2 pointer from a hWnd, but unfortunately not in AutoIt. As has been worked out previously, the current beta version does not allow one to pass an object in dllcall.

My solution is somewhat inelegant as I basically pass my hWnd and other info from AutoIt to a small VB6 program and use the VB6 program to get the IHTMLDocument2 pointer and do my revisions to the HTML code. I am attaching the VB6 support code for anyone interested, because the VB6 code out on the internet that supposedly does this has a variety of errors and does not explain how to arrange things.

Firse, paste the following in a REGULAR module (not a class module):

Type UUID
     Data1 As Long
     Data2 As Integer
     Data3 As Integer
     Data4(0 To 7) As Byte
  End Type
  
  Private Declare Function GetClassName Lib "user32" _
     Alias "GetClassNameA" ( _
     ByVal hWnd As Long, _
     ByVal lpClassName As String, _
     ByVal nMaxCount As Long) As Long
  
  Private Declare Function EnumChildWindows Lib "user32" ( _
     ByVal hWndParent As Long, _
     ByVal lpEnumFunc As Long, _
     lParam As Long) As Long
  
  Private Declare Function RegisterWindowMessage Lib "user32" _
     Alias "RegisterWindowMessageA" ( _
     ByVal lpString As String) As Long
  
  Private Declare Function SendMessageTimeout Lib "user32" _
     Alias "SendMessageTimeoutA" ( _
     ByVal hWnd As Long, _
     ByVal msg As Long, _
     ByVal wParam As Long, _
     lParam As Any, _
     ByVal fuFlags As Long, _
     ByVal uTimeout As Long, _
     lpdwResult As Long) As Long
        
  Private Const SMTO_ABORTIFHUNG = &H2
  
  Private Declare Function ObjectFromLresult Lib "oleacc" ( _
     ByVal lResult As Long, _
     riid As UUID, _
     ByVal wParam As Long, _
     ppvObject As Any) As Long
  
  Private Declare Function FindWindow Lib "user32" _
     Alias "FindWindowA" ( _
     ByVal lpClassName As String, _
     ByVal lpWindowName As String) As Long
  
  
  
  Private Function IsIEServerWindow(ByVal hWnd As Long) As Boolean
  Dim lRes As Long
  Dim sClassName As String
  
     ' Initialize the buffer
     sClassName = String$(100, 0)
     
     ' Get the window class name
     lRes = GetClassName(hWnd, sClassName, Len(sClassName))
     sClassName = Left$(sClassName, lRes)
     
     IsIEServerWindow = StrComp(sClassName, _
                       "Internet Explorer_Server", _
                       vbTextCompare) = 0
     
  End Function
  
  
  Function IEDOMFromhWnd(ByVal hWnd As Long) As IHTMLDocument
  
  Dim IID_IHTMLDocument As UUID
  Dim hWndChild As Long
  Dim lRes As Long
  Dim lMsg As Long
  Dim hr As Long
  
     If hWnd <> 0 Then
        
        If Not IsIEServerWindow(hWnd) Then
        
           ' Find a child IE server window
           Call EnumChildWindows(hWnd, AddressOf EnumChildProc, hWnd)
           
        End If
        
        If hWnd <> 0 Then
              
           ' Register the message
           lMsg = RegisterWindowMessage("WM_HTML_GETOBJECT")
              
           ' Get the object pointer
           Call SendMessageTimeout(hWnd, lMsg, 0, 0, _
                   SMTO_ABORTIFHUNG, 1000, lRes)
  
           If lRes Then
                 
              ' Initialize the interface ID
              With IID_IHTMLDocument
                 .Data1 = &H626FC520
                 .Data2 = &HA41E
                 .Data3 = &H11CF
                 .Data4(0) = &HA7
                 .Data4(1) = &H31
                 .Data4(2) = &H0
                 .Data4(3) = &HA0
                 .Data4(4) = &HC9
                 .Data4(5) = &H8
                 .Data4(6) = &H26
                 .Data4(7) = &H37
              End With
                 
              ' Get the object from lRes
              hr = ObjectFromLresult(lRes, IID_IHTMLDocument, _
                      0, IEDOMFromhWnd)
                 
           End If
  
        End If
        
     End If
  
  End Function
  
  Function EnumChildProc(ByVal hWnd As Long, lParam As Long) As Long
     
     If IsIEServerWindow(hWnd) Then
        lParam = hWnd
     Else
        EnumChildProc = 1
     End If
     
  End Function

Next, here is the code in your main Form_Load routine or wherever you want it.

Private Sub Form_Load()
  
  Dim lngHWnd As Long
  Dim ih2Associate As Object
  
  ' You can get your hWnd handle from AutoIt and save it in a file to pass to VB,
  ' or get it from other methods in VB if you want.  I'm just going to explicitly
  ' state it here.  If you get it from AutoIt, remember to convert the hex hWnd to 
  ' decimal.
  
  lngHWnd = 2295052
  
  ' Following routine uses the hWnd to get access to the IHTMLDocument2 pointer
  ' and extracts the HTML from the pointer
  
  Set ih2Associate = IEDOMFromhWnd(lngHWnd)
  msgbox(ih2Associate.body.innerHTML)
  
  End
  
  End Sub

EDIT: Please note that you must also add references (PROJECT > REFERENCES) to "Microsoft HTML Object Library" and "Accessibility" for this VB code to work

Edited by wliebkem
Link to comment
Share on other sites

First off a big big thanks to Dale for his tireless efforts in educating the unclean masses, (myself of course included), as I've been following this thread since it started with much interest.

I read through the thread a couple of times, but I still may have missed it, but here goes...

In post 37 Dale shows a great example of how to grab all the elements off of a page. This has been invaluable for me so far, since the page I'm trying to automate doesn't allow you to read the source code directly.

I've been able to get it to login to the page so I can try to poll the list of elements in the page, but when I try to read in the page after logging in, there's a nice list of elements including about 9 frame elements, which seems as though it is reading correctly, just not picking up the stuff out of the frames themselves. How do I pick the stuff out of those frames?

Keep in mind I have no way to access the source code of the page as rt click and view source are both disabled.

At least I have frame element names now. ;)

Thanks again!

-Crim

Link to comment
Share on other sites

Hi,

I've already asked this question on the support forum but was referred to this forum where the real gurus are :-)

I would like to check the availability of some of our websites. Right now one of our site returns "HTTP 500 - Internal Server Error".

How can I check the HTTP status code?

I tried IE.au3 and looked at _IEGetProperty but couldn't find a way to get the status code.

Thanks in advance

Thomas

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

There are ways to get an IHTMLDocument2 pointer from a hWnd, but unfortunately not in AutoIt. As has been worked out previously, the current beta version does not allow one to pass an object in dllcall.

Sure there is, but it doesn't look like it is documented. There is a DllCall() type "idispatch" and "idispatch_ptr" which are IDispatch* and IDispatch** appropriately. You can pass (AutoIt instantiated) COM objects or retrieve IDispatch-enabled COM objects by using those types.

I think your call (Off the top of my head) would be:

Local $aRet = DllCall("user32.dll", "idispatch", "SendMessage", "hwnd", $hWnd, "int", $WM_HTML_GETOBJECT, "int", 0, "int", 0)
If Not @error Then
    Local $oHTML = $aRet[0]
    If IsObj($oHTML) Then MsgBox(4096, "", "Success")
EndIf

That's, of course, all of the top of my head and so untested and perhaps just plain wrong but it should be close enough to be work-able.

Link to comment
Share on other sites

Sure there is, but it doesn't look like it is documented. There is a DllCall() type "idispatch" and "idispatch_ptr" which are IDispatch* and IDispatch** appropriately. You can pass (AutoIt instantiated) COM objects or retrieve IDispatch-enabled COM objects by using those types.

That's, of course, all of the top of my head and so untested and perhaps just plain wrong but it should be close enough to be work-able.

Thanks for that info... I had thought I hit a dead end when I came across the following thread terminator post on the support forums, for a user who was trying to accomplish the same thing. They did mention that you had been working on some of these things, but they were never able to get it working. Thanks for letting me know it can be done. I already have the VB support app in place, but as time permits I may try to port it to AutoIt.

Walt L.

this-is-me,

I know you have found an easier way to do this job, but I just wanted you to explain this COM issue.

The IHTMLDocument and IHTMLDocument2 are NOT objects. These are 'interfaces' to an Object. (in simple human terms, let's say I am an Object and you can talk to me by 'speaking' or by 'writing' me).

So you just can't just CREATE 'speaking', you have to meet the person first and find out in what ways you can communicate with him.

Since AutoIt script is 'datatypeless' you don't have to 'declare' a variable type. They are all of type 'Variant' and get their contents on assignment. (And no, Arrays are no exception. On a DIM you don't really declare them, you merely reserve space for the containing variants).

Also when a function returns a value through one of it's arguments (like in some UDF's), you use a DIM line to 'define' a name for the variable that will act as the placeholder for the data.

Same way with objects, you don't have to declare them. When some function want to give it a value, do a "DIM $col" or just give it an empty value, like "$col=0" (same as a dim).

However, your attempts with DLLCall will never work, because DLLCall does not yet understand return types of type 'Object'.

I know that Valik did some attempts using 'dispatch' pointers in DLLCall, but that requires a specific format on the DLL-side. It has never been documented however.

If it would work, then it would look like:

$hr = DllCall("oleacc.dll", "long", "ObjectFromLresult", "long", $lRes, "ptr" , DllStructPtr($IID_IHTMLDocument), "long", 0, "idispatch_ptr", "")
  
  $doc=hr[4]  ; This will put the HTMLDocument interface in $doc

But as I said, it has never been tested with windows DLL's and I doubt if it will work.

Regards,

-Sven

Link to comment
Share on other sites

There is a frame here that is getting you into trouble.

#include <IE.au3>

$oIE = _IECreate()
_IENavigate($oIE, "http://mio.discoremoto.virgilio.it/frrr/Hero%20CHINA/H01.JPG")
ConsoleWrite(_IEBodyReadHTML($oIE) & @CR)

$oFrame = _IEFrameGetObjByName($oIE, "main")
_IEClickLinkByText($oFrame, "News", 0, 0)

You'll see in the console that the only html on that page is a frame definition. You need to get a reference to the frame and then click on the link inside of it.

Note that the 0, 0 on the _IEClickLinkByText is being used to tell it not to wait for the page to dinish loading (the second 0) because you've uncovered a problem with the wait on a frame object that I'll have to take a look at.

Dale

I have tried impossibly to glean info off virgilio.it with this udf, but it seems to not be able to!

Try hard as a i may to get the Ie.au3 (and some code obviously) to click the link on this page.

http://mio.discoremoto.virgilio.it/frrr/Hero%20CHINA/H01.JPG

When I tried the utility (post 37) it gave nearly 0 info when you can clearly see there are several links and imgs. Quite curious...

Is it some bug on the site? Or is it due to the 'foreign language'? Or mayhaps a bug in the UDF/site combination...

Any ideas?

just..need...to click the scarica..... Urgh... ;)

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Thanks for the kind words. I'm glad this is useful for you.

Regarding the frames, you need to get an object reference to the frame that you want and then you treat that object the way you would the top level browser object (actually you access the document object inside it, but IE.au3 takes care of that next level of drilldown for you).

See in particular _IEFrameGetObjByName Also the previous reply includes an example of this for another query.

Dale

First off a big big thanks to Dale for his tireless efforts in educating the unclean masses, (myself of course included), as I've been following this thread since it started with much interest.

I read through the thread a couple of times, but I still may have missed it, but here goes...

In post 37 Dale shows a great example of how to grab all the elements off of a page. This has been invaluable for me so far, since the page I'm trying to automate doesn't allow you to read the source code directly.

I've been able to get it to login to the page so I can try to poll the list of elements in the page, but when I try to read in the page after logging in, there's a nice list of elements including about 9 frame elements, which seems as though it is reading correctly, just not picking up the stuff out of the frames themselves. How do I pick the stuff out of those frames?

Keep in mind I have no way to access the source code of the page as rt click and view source are both disabled.

At least I have frame element names now. ;)

Thanks again!

-Crim

edit: fix typo

Edited by DaleHohm

Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y

Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

Link to comment
Share on other sites

Thanks for the kind words. I'm glad this is useful for you.

Regarding the frames, you need to get an object reference to the frame that you want and then you treat that object the way you would the top level browser object (actually you access the document object inside it, by IE.au3 takes care of that next level of drilldown for you).

See in particular _IEFrameGetObjByName Also the previous reply includes an example of this for another query.

Dale

One other little thing, can you provide an example of proper usage of the _IEAttach function? I've tried:

$oIE = _IEAttach ("classname=Internet Explorer_Server1")

But it doesn't seem to properly attach.

(EDIT: Doh, I figured it out, looking at the function header, here's what I corrected it to below for anyone else to use:)

$oIE = _IEAttach ("http://www.yoursite.com", "URL")

Thanks again!

-Crim

Edited by Mr. Crimson
Link to comment
Share on other sites

The website I am testing is full of frames, so I had to wrap the _IELoadWait function to recursively check all the way down, like this:

Func frames_IELoadWait($o_object, $i_delay = 0)
    _IELoadWait($o_object, $i_delay)
; recurse into any frames
    for $i = 0 to _IEFrameGetCount($o_object)-1
        frames_IELoadWait(_IEFrameGetObjByIndex($o_object,$i), $i_delay)
    next
endfunc

I also made frames_ versions of some other functions, like this:

func frames_IEClickLinkByText($o_object, $s_linkText, $i_index = 0, $f_wait = 0)
    local $ret = _IEClickLinkByText($o_object,$s_linkText,$i_index,$f_wait)
; recurse into any frames if we didn't find it
    if $ret = 0 then
        for $i = 0 to _IEFrameGetCount($o_object)-1
            $ret = frames_IEClickLinkByText(_IEFrameGetObjByIndex($o_object,$i),$s_linkText,$i_index,$f_wait)
            if $ret <> 0 then
                return $ret
            endif
        next
        return 0
    else
        return $ret
    endif
endfunc

which makes using those functions work in a mega-framed web page like the ones I have to use. Hope someone finds this useful.

Roger

Link to comment
Share on other sites

How would I go about clicking a particular login link, if there are 2 or more of them on a page. The _IEClickLinkByText() function just clicks the first instance of the requested link, which for my purposes is OK for now because that is the one I want. However, the application I am working with is being upgraded consistantly, and a new version may be added to the page, and now the login link I want could be the 2nd or 3rd on the page.

Also, I have a situation where I have a page with 1 form, and 6 submit buttons each of with are named "action", but each have a unique value. I want to click the 6th button, however, if I use the _IEFormSubmit() function I fear it may submit the form with the value of the first button. I have tried using the following code:

$o_all = _IETagNameAllGetCollection ($oIE); get collection
$o_all.item("allbox").click; click the select all check box
$o_all.item("action")(5).click ; click the 6th submit button (treating it like an array)

I have even tried the following:

$o_all = _IETagNameAllGetCollection ($oIE); get collection
$o_all.item("allbox").click; click the select all check box
$o_all.item("Unregister").click ; click the 6th submit button by value

I tried getting the INPUT tags as an arrary with the following, but that errors out.

$o_all = _IETagNameAllGetCollection ($oIE)
$o_all.item("allbox").click; click the select all check box
$o_submitButtons = _IETagNameGetCollection($oIE, "input"); create an array of all input tags
$o_submitButtons(5).click; click the 6th submit button

Any suggestions? I cannot rename the tags or links, I have to work with the system as is.

Link to comment
Share on other sites

How would I go about clicking a particular login link, if there are 2 or more of them on a page. The _IEClickLinkByText() function just clicks the first instance of the requested link, which for my purposes is OK for now because that is the one I want. However, the application I am working with is being upgraded consistantly, and a new version may be added to the page, and now the login link I want could be the 2nd or 3rd on the page.

You can count which instance the link is as far as the first, second, or twentieth, and so on, and still use the _IEClickLinkByLink() function. I recently had to do that for the first time, although I used the _IEClickImg() function, as shown below:

_IEClickImg($oFrame, "linktoimage.gif", "src", 0)

Where 0 is the first instance of the image, and say, 5 would be the 6th instance of the image.

(Sorry, only half my thoughts went onto the page... edits above)

Best Regards-

-Crim

Edited by Mr. Crimson
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...