Py学习  »  Python

Selenium Python:无法清除chrome浏览器缓存

VISHVAMBRUTHJAVAGALTHIMMEGOWDA • 6 年前 • 4138 次点击  

导航到chrome://settings/clear browser data后,单击下面的“清除数据”按钮,尝试清除chrome浏览器缓存。但我无法点击“清除数据”按钮。请告知。

enter image description here

我用的是:

操作系统: 赢得10 pro 64位

python版本: 3.6.1条

Chrome版本: 74.0.3729.169(官方版本)(64位)

def clear_current_session(self):

    # Opens a new tab
    self.driver.execute_script("window.open()")

    # Switch to the newly opened tab
    self.driver.switch_to.window(self.driver.window_handles[1])

    # Navigate to new URL in new tab
    self.driver.get("chrome://settings/clearBrowserData")

    #Click on the Clear data button
    self.driver.find_element_by_css_selector("* /deep/ #clearBrowsingDataConfirm").click()

    self.driver.implicitly_wait(60)

    # Switch to original tab
    self.driver.switch_to.window(self.driver.window_handles[0])
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/51337
文章 [ 2 ]  |  最新文章 6 年前