Sign in to follow this  
Followers 0
FrikinImpossible

Reading IE Developer (F12) Network Traffic

2 posts in this topic

Hello Everyone,

This is my first post on the Autoit Forums, though I've been making personal scripts using AutoIt for quite a while now.

To begin, my application requires the network data that is captured by Internet Explorer's Developer (F12) window under the network tab.

My current solution uses ControlClick to "Export Captured Traffic", which brings up a "Save As" window, which can easily be manipulated. The resulting XML can also easily be read for the information my application requires. The problem is that this solution is clunky and distracting, requiring windows to be brought to the front and focused.

Is there any way to read the information in the Network tab of the unpinned IE Developer window directly?

I've tried searching for information on the "syslistview32" class that the information is contained in, but can only get as far as retrieving the number of items in the list.

My current code:

#include <String.au3>
#include <IE.au3>
#include <File.au3>

AutoItSetOption( "WinTitleMatchMode" , 2);

if FileExists(@DesktopDir & "\NetworkData.xml") then
FileDelete(@DesktopDir & "\NetworkData.xml")
EndIf;

;; Clicks the Export Network Data button
if not ControlClick("F12","","[ID:1005]","left","1",60,11) Then
MsgBox(64, "Save","The export network data save option could not be selected!!");
Exit;
EndIf;

;; Waits for Save Dialogbox
if not winwaitActive("Save As" ,"", 5) Then
MsgBox(64, "Save As","The Save As dialog could not be activated");
Exit;
EndIf;

;; Sets location to desktop
ControlClick( "Save As","Tree View","","left","1",58,41);

;; Clicks Save
ControlClick("Save As", "&Save", "[CLASS:Button; INSTANCE:1]");

;; Clicks on Clear
sleep(500);
ControlClick("F12","","Clear");

Posted Image

Share this post


Link to post
Share on other sites



Alright, I figured it out!!!

The problem:

Using ControlListView's FindItem has problem's mixing architectures. The autoit script was running (Go - F5) in 64bit by default, while the IE window was in 32bit. This caused FindItem to return blank strings.

Setting autoit to run in x86 allowed me to use ControlListView's FindItem option.

#AutoIt3Wrapper_UseX64=n;

Still, FindItem would crash internet explorer when the list grew large, so I found a work around.

Here is the code I used to read the data in the IE Developer window:

#include <String.au3>
#include <IE.au3>
#AutoIt3Wrapper_UseX64=n;

AutoItSetOption("WinTitleMatchMode", 2)

$iCount = ControlListView("F12", "", "SysListView323", "GetItemCount");

$url = "";
For $i=0 To $iCount -1
$type = ControlListView("F12","", "SysListView323","GetText", $i,4)
if $type = "audio/mp4" Then
$url = ControlListView("F12","", "SysListView323","GetText", $i, 1)
ExitLoop;
EndIf;
Next

if $url = "" Then
MsgBox(64, "URL Error", "Could not find Audio URL in dev window!");
Exit;
endif;

MsgBox(64, "List View", $url);

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
Sign in to follow this  
Followers 0