Search code examples
charles-proxy

How to save Charles session to a file from command line?


I wonder how to save charles session to a file.

Consider following script :

open -ga Charles --args -headless -config charles.xml results.chls
#...some interactions here
pgrep -f Charles | xargs kill

I'm expecting to see something in the results.chls but file is empty....


Solution

  • I figured it out myself. Seems like the only way is enable web control access for Charles and use http like this:

    curl --silent -x localhost:8888 http://control.charles/session/export-har -o "${EXPORT_FILE}" > /dev/null