1
1
mirror of https://github.com/KenanZhu/AutoLibrary.git synced 2026-06-18 23:43:02 +08:00

refactor: 时间选择逻辑下沉至 Dialog、Worker 模板方法抽象、配置访问安全化与代码风格统一

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-27 19:54:26 +08:00
parent 345cb95b98
commit e77c561685
18 changed files with 599 additions and 465 deletions
+11 -19
View File
@@ -19,7 +19,6 @@ from selenium.common.exceptions import (
)
from pages.components.SeatMapDialog import SeatMapDialog
from pages.components.ReserveResultDialog import ReserveResultDialog
class ReserveView:
@@ -102,31 +101,30 @@ class ReserveView:
def selectRoom(
self,
room: str,
) -> bool:
) -> SeatMapDialog | None:
try:
WebDriverWait(self._driver, 2).until(
EC.element_to_be_clickable(self.FIND_ROOM_BTN)
).click()
except (TimeoutException, ElementNotInteractableException):
return False
return None
except Exception:
return False
return None
try:
WebDriverWait(self._driver, 2).until(
EC.element_to_be_clickable((By.ID, self.ROOM_BTN_FMT.format(room=room)))
).click()
return True
except (TimeoutException, ElementNotInteractableException):
return False
return None
except Exception:
return False
def openSeatMap(
self,
) -> SeatMapDialog:
return SeatMapDialog(self._driver)
return None
try:
return SeatMapDialog(self._driver)
except (TimeoutException):
return None
except Exception:
return None
def submitReserve(
self,
@@ -142,12 +140,6 @@ class ReserveView:
except Exception:
return False
def waitResultDialog(
self,
) -> ReserveResultDialog:
return ReserveResultDialog(self._driver)
def refresh(
self,
) -> None: