[英]How to use Safari Browser in Selenium Webdriver using Python bindings
I am not able to launch safari browser from Selenium web driver. 我无法从Selenium网络驱动程序启动safari浏览器。 I am using Python bindings. 我正在使用Python绑定。 Could not find any reference that provided detailed steps for Python. 找不到任何提供Python详细步骤的参考资料。 I am aware there is a related question on stackoverflow, but it doesn't answer for python - python selenium webdriver safari driver 我知道stackoverflow上有一个相关的问题,但它没有回答python - python selenium webdriver safari驱动程序
Followed the Documentation on http://code.google.com/p/selenium/wiki/SafariDriver , downloaded and installed safari developer certificate. 按照http://code.google.com/p/selenium/wiki/SafariDriver上的文档,下载并安装了safari开发人员证书。 This doc has code for Java and not for python bindings. 这个doc有Java代码,而不是python绑定代码。
Below is my code(I am using desired capabilities) Not sure what am I missing here - 下面是我的代码(我正在使用所需的功能)不确定我在这里缺少什么 -
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()
From the looks of it, you're trying to open a webpage with a webbrowser. 从它的外观来看,你正试图用webbrowser打开一个网页。 Why not use "webbrowser"? 为什么不使用“webbrowser”? It's easy to get the webbrowser have safari as default: Web浏览器很容易将safari作为默认值:
import webbrowser
browser = webbrowser.get('safari')
browser.open("http://www.google.com/")
As I can't selenium set up, I'm not sure if this is what you want. 由于我不能设置硒,我不确定这是否是你想要的。 Who knows, it could be an alternative? 谁知道,它可能是另一种选择?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.