Author SHA1 Message Date
TheRaiwy cd712e992d Fix cookie login: add path/secure attrs, check auth before setting
tests / test (push) Successful in 5s
tests / release (push) Successful in 5s
2026-07-10 19:56:23 +03:00
TheRaiwy 872acb8449 Dismiss modal dialogs before interacting with login form
tests / test (push) Successful in 6s
tests / release (push) Successful in 5s
2026-07-10 19:55:10 +03:00
+24 -4
View File
@@ -302,8 +302,10 @@ def save_result(acc: dict, category: str, msg: str = "") -> None:
def _cookie_login(driver, cookie: str) -> bool: def _cookie_login(driver, cookie: str) -> bool:
driver.get("https://www.roblox.com") driver.get("https://www.roblox.com/home")
time.sleep(2) time.sleep(2)
if "/login" not in driver.current_url:
return True
try: try:
accept = WebDriverWait(driver, 3).until(EC.element_to_be_clickable((By.XPATH, "//button[text()='Accept All']"))) accept = WebDriverWait(driver, 3).until(EC.element_to_be_clickable((By.XPATH, "//button[text()='Accept All']")))
accept.click() accept.click()
@@ -311,11 +313,18 @@ def _cookie_login(driver, cookie: str) -> bool:
except Exception: except Exception:
pass pass
try: try:
driver.add_cookie({"name": ".ROBLOSECURITY", "value": cookie, "domain": ".roblox.com"}) driver.add_cookie({
"name": ".ROBLOSECURITY",
"value": cookie,
"domain": ".roblox.com",
"path": "/",
"secure": True,
})
driver.get("https://www.roblox.com/home") driver.get("https://www.roblox.com/home")
time.sleep(3) time.sleep(4)
return "/login" not in driver.current_url return "/login" not in driver.current_url
except Exception: except Exception as e:
log.warning("Cookie login error: %s", e)
return False return False
@@ -346,6 +355,17 @@ def process_account(driver, acc: dict, donor_video: Path | None,
except Exception: except Exception:
pass pass
# close any modal dialogs blocking the login form
for _ in range(10):
try:
modal = driver.find_element(By.XPATH, "//h4[@class='modal-title']/ancestor::div[contains(@class, 'modal')]")
close_btn = modal.find_element(By.XPATH, ".//button[contains(@class, 'close')]")
close_btn.click()
log.info("Dismissed login modal")
time.sleep(1)
except Exception:
break
username_input = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, "login-username"))) username_input = WebDriverWait(driver, 10).until(EC.element_to_be_clickable((By.ID, "login-username")))
ActionChains(driver).move_to_element(username_input).pause(0.3).perform() ActionChains(driver).move_to_element(username_input).pause(0.3).perform()
time.sleep(0.1); username_input.click(); time.sleep(0.1); username_input.clear() time.sleep(0.1); username_input.click(); time.sleep(0.1); username_input.clear()