Bubbles30 commited on
Commit
a9112bb
·
verified ·
1 Parent(s): fef1f33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -19,6 +19,13 @@ from selenium import webdriver
19
  from selenium.webdriver.chrome.options import Options
20
  from selenium.webdriver.chrome.service import Service
21
  from webdriver_manager.chrome import ChromeDriverManager
 
 
 
 
 
 
 
22
 
23
  # === Globals & Configuration ===
24
  stop_event = threading.Event()
@@ -68,8 +75,8 @@ def download_image(url, out_path, fail_log, code, suf):
68
  from webdriver_manager.chrome import ChromeDriverManager
69
 
70
  def log(msg):
71
- entry = f"{code}{suf}: {msg}"
72
- print(entry) # See logs in console/output
73
  with open(fail_log, "a") as f:
74
  f.write(entry + "\n")
75
 
 
19
  from selenium.webdriver.chrome.options import Options
20
  from selenium.webdriver.chrome.service import Service
21
  from webdriver_manager.chrome import ChromeDriverManager
22
+ from selenium.webdriver.common.by import By
23
+ from selenium.webdriver.support.ui import WebDriverWait
24
+ from selenium.webdriver.support import expected_conditions as EC
25
+
26
+ wait = WebDriverWait(driver, 15)
27
+ img_el = wait.until(EC.presence_of_element_located((By.TAG_NAME, "img")))
28
+
29
 
30
  # === Globals & Configuration ===
31
  stop_event = threading.Event()
 
75
  from webdriver_manager.chrome import ChromeDriverManager
76
 
77
  def log(msg):
78
+ entry = f"{code}{suf}: {msg}"
79
+ print(entry) # See logs in console/output
80
  with open(fail_log, "a") as f:
81
  f.write(entry + "\n")
82