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

R20lg.png

我正在使用:

操作系统:Win 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])

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐