简体   繁体   中英

How do I run my own code interacting with a browser?

To make my life easy I'd like to run scripts in a browser and log the output. The two ways I have done it isn't a complete solution. The most recent thing I did was write a userscript to do console.log on AJAX post response, have an autohotkey script to mash buttons and then I copy/paste the results to a file. My biggest issue is firefox collapses some lines on the console if they're very long . I'd try on chrome but the userscript doesn't work on chrome

In the past I embed Firefox/Gecko in C# but I'm not sure how to capture post events and sometimes it feels like overkill.

What's the most simple way I can run a simple script in a browser and capture the results? Right now the idea solution might be modifying the userscript to POST the response to localhost where I write the response to a file and keep using the autohotkey script to produce the events. Does anyone have a better solution?

For controlling web browsers from code, selenium is pretty good.

I also found this component , which claims to work with selenium and give you HTTP traffic monitoring.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM