mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-03-12 10:31:50 +01:00
fix: improve login detection with fallback element (#493)
- Add fallback check for user-email element when mr-medium is not found - Improve login detection reliability - Add test case for alternative login element
This commit is contained in:
@@ -540,11 +540,18 @@ class KleinanzeigenBot(WebScrapingMixin):
|
||||
|
||||
async def is_logged_in(self) -> bool:
|
||||
try:
|
||||
# Try to find the standard element first
|
||||
user_info = await self.web_text(By.CLASS_NAME, "mr-medium")
|
||||
if self.config["login"]["username"].lower() in user_info.lower():
|
||||
return True
|
||||
except TimeoutError:
|
||||
return False
|
||||
try:
|
||||
# If standard element not found, try the alternative
|
||||
user_info = await self.web_text(By.ID, "user-email")
|
||||
if self.config["login"]["username"].lower() in user_info.lower():
|
||||
return True
|
||||
except TimeoutError:
|
||||
return False
|
||||
return False
|
||||
|
||||
async def delete_ads(self, ad_cfgs:list[tuple[str, dict[str, Any], dict[str, Any]]]) -> None:
|
||||
|
||||
Reference in New Issue
Block a user