This commit is contained in:
2026-06-16 16:56:27 +03:30
parent a5d09be46e
commit 24155ad6bf
22 changed files with 2485 additions and 762 deletions
+4 -5
View File
@@ -2,11 +2,9 @@
from __future__ import annotations
import undetected_chromedriver as uc
from selenium.common.exceptions import TimeoutException
from selenium.webdriver.support.ui import WebDriverWait
from config import config
from crawler.driver import human_delay, make_driver
from crawler.driver import human_delay
class FreshSessionScenario:
@@ -19,8 +17,9 @@ class FreshSessionScenario:
explicitly delete all cookies after loading to be safe.
"""
def __init__(self, driver: uc.Chrome, timeout: int = 30) -> None:
def __init__(self, driver: uc.Chrome, url: str, timeout: int = 30) -> None:
self.driver = driver
self.url = url
self.wait = WebDriverWait(driver, timeout)
def run(self) -> dict[str, object]:
@@ -32,7 +31,7 @@ class FreshSessionScenario:
"try { window.localStorage.clear(); window.sessionStorage.clear(); } catch(e) {}"
)
self.driver.get(config.target_url)
self.driver.get(self.url)
human_delay(2.0, 4.0)
# Wait for the page to reach a ready state