Java API to Interact with Fiddler

2 posts, 0 answers
  1. Ravichandran
    Ravichandran avatar
    1 posts
    Member since:
    Mar 2018

    Posted 28 Mar Link to this post

    Hi, 

    I am trying to get the HTTP/WS Calls from the browser driver using the proxy.  I have configured chrome driver to use the proxy as shown below.

    DesiredCapabilities capabilities = DesiredCapabilities.chrome();
                // Create a new proxy object and set the proxy
                Proxy proxy = new Proxy();
               proxy.setHttpProxy("localhost:8888");
               proxy.setSslProxy("localhost:8888");
                //Add the proxy to our capabilities 
                capabilities.setCapability("proxy", proxy);
                //Start a new ChromeDriver using the capabilities object we created and added the proxy to
                 driver = new ChromeDriver(capabilities);

    If Fiddler is opened in my machine, it captures all the calls from the driver and i can export the calls manually. 

    Is there any API for Java to interact with Fiddler so that I can start Fiddler before my execution starts and Export the Calls as HAR whenever I need and Close Fiddler once my execution gets complete. 

    I found a jar Fiddler 2.3.3 in Maven repo but I don't know the usage of this jar. 

    https://mvnrepository.com/artifact/org.apache.river/fiddler/2.2.3

    can anyone help me on this?

    Share me the java code samples to interact with Fiddler.

     

     

     

  2. Simeon
    Admin
    Simeon avatar
    116 posts

    Posted 03 Apr Link to this post

    Hi Ravichandran,

    We support no Java API for Fiddler. However, you could try to start Fiddler in a different process. I believe that Java could do this. Then, there should be an ExecAction.exe file in the installation directory of Fiddler (%LOCALAPPDATA%\Programs\Fiddler) by default. This executable accepts arguments which are passed to the OnExecAction method in the FiddlerScript. For example, if you type in the terminal ExecAction.exe "log Hello from ExecAction!", this would write in the Fiddler's log "Hello from ExecAction!". If you type ExecAction.exe quit, this would close Fiddler. Of course, you could start the ExecAction process from Java the same way you started Fiddler and also pass the arguments which you need.

    You could also add functionality into your OnExecAction method in the FiddlerScript to export the sessions. Some methods which you could use for this are FiddlerApplication.DoExport(string sExportFormat, Session[] oSessions, Dictionary<string, object> dictOptions, EventHandler<ProgressCallbackEventArgs> ehPCEA) where the export format in your case is "HTTPArchive v1.1" or "HTTPArchive v1.2", you could get the sessions with FiddlerApplication.GetAllSessions() method and add "Filename" key into the dictOptions argument.

    Regards,
    Simeon
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top