如何在使用Python绑定的Selenium Webdriver中使用Safari浏览器

2024-04-27 03:43:30 发布

您现在位置:Python中文网/ 问答频道 /正文

我无法从Selenium web驱动程序启动safari浏览器。我正在使用Python绑定。 找不到为Python提供详细步骤的任何引用。 我知道stackoverflow上有一个相关的问题,但它不能回答python- python selenium webdriver safari driver

遵循http://code.google.com/p/selenium/wiki/SafariDriver上的文档,下载并安装了safari开发人员证书。此文档包含Java代码,而不是python绑定代码。

下面是我的代码(我正在使用所需的功能)不确定我在这里缺少什么-

from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
from selenium import webdriver

browser = webdriver.Remote(desired_capabilities=webdriver.DesiredCapabilities.SAFARI)
browser.get('http://www.google.com')
browser.close()

Tags: 代码from文档importbrowsercomhttpselenium