python - Selenium 蟒: open default profile in opera

标签 python selenium

如何在 Opera 中打开默认配置文件? 我的意思是和我在歌剧院打开展台时一样的轮廓。 此代码只是打开了一个新的配置文件:

import os
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
os.environ["SELENIUM_SERVER_JAR"] = '/home/brian/bin/selenium-server-standalone-2.37.0.jar'
capabilities = DesiredCapabilities.OPERA
capabilities['opera.profile'] = ''  
browser = webdriver.Opera(desired_capabilities=capabilities)

最佳答案

基本上,您可以像使用 Chrome 一样设置配置文件。

from selenium import webdriver
opera_profile = 'C:\\Users\\<username>\\AppData\\roaming\Opera software\\Opera Stable'  # relevant for Windows 7 and above
options = webdriver.ChromeOptions()
options.add_argument('user-data-dir=' + opera_profile)
opera_driver = webdriver.Opera(executable_path=<path_to_operadriver>, opera_options=options)

关于python - Selenium 蟒: open default profile in opera,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19619931/

相关文章:

python - 在 Mac 上运行 PyGTK : AttributeError: xid attribute not supported?

python - selenium webdriver 的 tcp/ip 端口耗尽

python - 如何将 Pandas 数据框转换为具有列表中值的字典

python - pandas 中的回归列

javascript - chromedriver 清除缓存 - java

python - 如何在一个站点表格内容中定位元素

javascript - 使用异步命令 Chai 断言不会失败?

java - 在没有 http 或 https 的情况下在 selenium 中传递 URL

python - 将第一个单元格与行和计数匹配的其他值进行比较

python - 'RelationshipProperty' 对象在 sqlalchemy 中没有属性 'c' 错误