无法使用chromedriver 2.45清除浏览数据

时间:2018-12-21 18:22:54

标签: python selenium google-chrome selenium-chromedriver

我无法使用chromedriver 2.45清理浏览器缓存

我正在尝试根据https://intoli.com/blog/clear-the-chrome-browser-cache/

清理缓存

这在chromedriver 2.41上正常工作,但在升级chromedriver时失败

from selenium.webdriver.support.ui import WebDriverWait


def get_clear_browsing_button(driver):
    """Find the "CLEAR BROWSING BUTTON" on the Chrome settings page."""
    return driver.find_element_by_css_selector('* /deep/ #clearBrowsingDataConfirm')


def clear_cache(driver, timeout=60):
    """Clear the cookies and cache for the ChromeDriver instance."""
    # navigate to the settings page
    driver.get('chrome://settings/clearBrowserData')

    # wait for the button to appear
    wait = WebDriverWait(driver, timeout)
    wait.until(get_clear_browsing_button)

    # click the button to clear the cache
    get_clear_browsing_button(driver).click()

    # wait for the button to be gone before returning
    wait.until_not(get_clear_browsing_button)

使用chromedriver 2.45,我看到以下错误

element not interactable
Session info: chrome=71.0.3578.98)
(Driver info: chromedriver=2.45.615355 (d5698f682d8b2742017df6c81e0bd8e6a3063189),platform=Mac OS X 10.13.6 x86_64)

0 个答案:

没有答案