Controlling a browser using Python, on a Mac

后端 未结 10 2208
小鲜肉
小鲜肉 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条回答
  •  闹比i
    闹比i (楼主)
    2021-02-02 03:33

    Take a look at PyShell (an extension to PyXPCOM).

    Example:

    promptSvc = components.classes["@mozilla.org/embedcomp/prompt-service;1"].\
            getService(Components.interfaces.nsIPromptService)
    promptSvc.alert(None, 'Greeting...', "Hello from Python")
    

提交回复
热议问题