【发布时间】:2015-11-14 00:17:39
【问题描述】:
我正在尝试将 CEF 用于类似功能的 chrome 配置文件。经过一番谷歌搜索后,我发现 CEF 通过 CefSettings.cache_path 和 --cache-path 支持类似的功能。
但我无法弄清楚如何通过 chromedriver 设置此功能。
【问题讨论】:
标签: python selenium webdriver selenium-chromedriver chromium-embedded
我正在尝试将 CEF 用于类似功能的 chrome 配置文件。经过一番谷歌搜索后,我发现 CEF 通过 CefSettings.cache_path 和 --cache-path 支持类似的功能。
但我无法弄清楚如何通过 chromedriver 设置此功能。
【问题讨论】:
标签: python selenium webdriver selenium-chromedriver chromium-embedded
您可以使用 chromeOptions 将缓存路径作为参数传递。
请在下面找到示例代码:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chromeOptions = Options()
chromeOptions.add_argument("--cache-path=C:\\CEF\\c_path")
chromeOptions.binary_location = r"C:\cef_binary_client\Release\cefclient.exe"
driver = webdriver.Chrome(executable_path=r"C:\Driver\chromedriver_220.exe", chrome_options=chromeOptions)
driver.get("https://google.com")
s = "test"
driver.find_element_by_name("q").send_keys(s)
【讨论】: