【问题标题】:How do I set user data directory in chromium-embedded with chromedriver?如何在 chromedriver 中设置用户数据目录?
【发布时间】:2015-11-14 00:17:39
【问题描述】:

我正在尝试将 CEF 用于类似功能的 chrome 配置文件。经过一番谷歌搜索后,我发现 CEF 通过 CefSettings.cache_path 和 --cache-path 支持类似的功能。

但我无法弄清楚如何通过 chromedriver 设置此功能。

【问题讨论】:

    标签: python selenium webdriver selenium-chromedriver chromium-embedded


    【解决方案1】:

    您可以使用 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)
    

    【讨论】:

    • 能否提供下载cefclient.exe的链接?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-06-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-07-21
    • 2021-01-18
    • 2023-01-28
    相关资源
    最近更新 更多