在Mac上使用Python控制浏览器 [英] Controlling a browser using Python, on a Mac

查看:968
本文介绍了在Mac上使用Python控制浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种使用Python以编程方式控制Mac上浏览器的方式(即Firefox或Safari或Chrome / -ium或Opera,但不是IE)。



我需要的操作包括以下链接,检查页面中是否存在元素以及提交表单。

您推荐哪种解决方案?

$ b

解决方案

请看


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 include following links, checking if elements exist in a page, and submitting forms.

Which solution would you recommend?

解决方案

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")

这篇关于在Mac上使用Python控制浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆