Controlling a browser using Python, on a Mac

后端 未结 10 2301
小鲜肉
小鲜肉 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:19

    Check out python-browsercontrol.

    Also, you could read this forum page (I know, it's old, but it seems extremely relevant to your question): http://bytes.com/topic/python/answers/45528-python-client-side-browser-script-language

    Also: http://docs.python.org/library/webbrowser.html

    Example:

    from browser import *
    my_browser = Firefox(99, '/usr/lib/firefox/firefox-bin') my_browser.open_url('cnn.com')
    

    open_url returns when the cnn.com home page document is loaded in the browser frame.

提交回复
热议问题