【问题标题】:How to start Selenium (Chrome Driver) on a profile, with cookies etc inherited, on Python? [closed]如何在 Python 上使用继承的 cookie 等在配置文件上启动 Selenium(Chrome 驱动程序)? [关闭]
【发布时间】:2018-06-01 04:21:17
【问题描述】:

在 Python 上进行实验,并希望 Selenium 填写一个只有在将某些内容添加到购物车后才可用的表单。我不确定如何设置它以预先设置 cookie/配置文件。我该怎么做?

【问题讨论】:

  • 这不是问题,您希望我们为您提供什么帮助?
  • 我在询问如何使用配置文件启动 Selenium,以及我在普通 Chrome 上的 cookie。我正在使用 Chromedriver

标签: python selenium


【解决方案1】:

您需要使用user-data-dir 命令行开关启动 chrome 以指定要使用的自定义配置文件(否则它将创建一个新的临时配置文件)。

例如:

options = webdriver.ChromeOptions() 
options.add_argument('user-data-dir=/path/to/profile')
driver = webdriver.Chrome(chrome_options=options)

/通过https://sites.google.com/a/chromium.org/chromedriver/capabilities

【讨论】:

  • 谢谢伙计。这行得通。
猜你喜欢
  • 2017-12-10
  • 2014-11-16
  • 1970-01-01
  • 1970-01-01
  • 2016-05-20
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多