
added a cache clearing, so that system won't shutdown out of storage
@576f134d80520f66ab60e6ce9bd59ea6fae1a557
--- utils/cache_clear.py
+++ utils/cache_clear.py
... | ... | @@ -1,26 +1,25 @@ |
1 |
-import undetected_chromedriver as uc |
|
1 |
+# import undetected_chromedriver as uc |
|
2 | 2 |
from selenium.webdriver.common.action_chains import ActionChains |
3 | 3 |
from selenium.webdriver.common.keys import Keys |
4 | 4 |
from webdriver_manager.chrome import ChromeDriverManager |
5 | 5 |
from time import sleep |
6 | 6 |
|
7 | 7 |
|
8 |
-options = uc.ChromeOptions() |
|
9 |
-driver = uc.Chrome(driver_executable_path=ChromeDriverManager().install(), options=options) |
|
8 |
+# options = uc.ChromeOptions() |
|
9 |
+# driver = uc.Chrome(driver_executable_path=ChromeDriverManager().install(), options=options) |
|
10 | 10 |
|
11 | 11 |
def delete_cache(driver): |
12 |
- driver.execute_script("window.open('')") # Create a separate tab than the main one |
|
12 |
+ # driver.execute_script("window.open('')") # Create a separate tab than the main one |
|
13 | 13 |
driver.switch_to.window(driver.window_handles[-1]) # Switch window to the second tab |
14 | 14 |
driver.get('chrome://settings/clearBrowserData') # Open your chrome settings. |
15 |
- sleep(3) |
|
15 |
+ sleep(1) |
|
16 | 16 |
actions = ActionChains(driver) |
17 | 17 |
actions.key_down(Keys.SHIFT).send_keys(Keys.TAB * 6).key_up(Keys.SHIFT) #select "all time" browsing data |
18 | 18 |
actions.perform() |
19 |
- sleep(3) |
|
19 |
+ sleep(1) |
|
20 | 20 |
actions.send_keys(Keys.DOWN * 5 + Keys.TAB * 7 + Keys.ENTER) #click on "clear data" button |
21 | 21 |
actions.perform() |
22 |
- sleep(3) |
|
23 |
- driver.close() |
|
22 |
+ sleep(1) |
|
24 | 23 |
driver.switch_to.window(driver.window_handles[0]) |
25 | 24 |
print("Succesfully cleared the browsing data") |
26 | 25 |
|
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?