docs: adds documentation to login function
Adds a detailed docstring to the `keep_login_status` function, clarifying its purpose, arguments, return value, and behavior during login attempts.
This commit is contained in:
parent
6523fecb5a
commit
77054f1d84
|
@ -46,6 +46,21 @@ class LoginInfo():
|
|||
|
||||
|
||||
def keep_login_status(driver: webdriver.Chrome, login_info: LoginInfo) -> bool:
|
||||
"""
|
||||
Attempt to log into the CHI MotorWeb ERP system using the provided login information.
|
||||
|
||||
This function navigates to the login page, fills in the login form with the user’s credentials,
|
||||
and attempts to log in. It handles unexpected alert pop-ups that indicate login failure,
|
||||
and manages browser windows to ensure only the relevant page remains open.
|
||||
|
||||
Args:
|
||||
driver (webdriver.Chrome): An instance of Selenium WebDriver controlling a Chrome browser.
|
||||
login_info (LoginInfo): A data object containing login credentials and preferences.
|
||||
|
||||
Returns:
|
||||
bool: True if login is successful or already logged in; False if login failed (e.g., due to incorrect credentials).
|
||||
"""
|
||||
|
||||
# * Close all windows except the main window.
|
||||
while len(driver.window_handles) > 1:
|
||||
driver.switch_to.window(driver.window_handles[1])
|
||||
|
|
Loading…
Reference in New Issue