Controlling a browser using Python, on a Mac

后端 未结 10 2300
小鲜肉
小鲜肉 2021-02-02 02:57

I\'m looking for a way to programatically control a browser on a Mac (i.e. Firefox or Safari or Chrome/-ium or Opera, but not IE) using Python.

The actions I need includ

10条回答
  •  面向向阳花
    2021-02-02 03:16

    Might be a bit restrictive, but py-appscript may be the easiest way of controlling a Applescript'able browser from Python.

    For more complex things, you can use the PyObjC to achieve pretty much anything - for example, webkit2png is a Python script which uses WebKit to load a page, and save an image of it. You need to have a decent understanding of Objective-C and Cocoa/etc to use it (as it just exposes ObjC objects to Python)

    Screen-scaping may achieve what you want with much less complexity.

提交回复
热议问题