fix
This commit is contained in:
@@ -16,15 +16,15 @@ class SteamLogin():
|
||||
if not os.path.exists('credentials_backup.json'):
|
||||
open('credentials_backup.json', 'w').write(json.dumps({'accounts': []}))
|
||||
|
||||
options = Options()
|
||||
self.options = Options()
|
||||
prefs = {
|
||||
"credentials_enable_service": False,
|
||||
"profile.password_manager_enabled": False,
|
||||
"profile.password_manager_leak_detection": False # Отключение проверки утечек паролей
|
||||
}
|
||||
options.add_experimental_option("prefs", prefs)
|
||||
self.options.add_experimental_option("prefs", prefs)
|
||||
self.driver = webdriver.Chrome(
|
||||
options=options
|
||||
options=self.options
|
||||
)
|
||||
|
||||
def __wait_get(self, xpath: str, timeout: int = 15):
|
||||
@@ -43,6 +43,15 @@ class SteamLogin():
|
||||
|
||||
open('credentials_backup.json', 'w').write(json.dumps(data))
|
||||
|
||||
|
||||
def __restart_driver(self):
|
||||
self.driver.quit()
|
||||
self.driver = webdriver.Chrome(
|
||||
options=self.options
|
||||
)
|
||||
self.driver.get("https://steamcommunity.com/login/home/?goto=")
|
||||
# time.sleep(15)
|
||||
|
||||
|
||||
def open_steam_login_page_and_type(self):
|
||||
# Открываем страницу входа в Steam
|
||||
@@ -60,13 +69,13 @@ class SteamLogin():
|
||||
if account in archive:
|
||||
continue
|
||||
|
||||
time.sleep(30)
|
||||
# time.sleep(30)
|
||||
|
||||
username = account['username']
|
||||
password = account['password']
|
||||
|
||||
# Задержка перед заходом в аккаунт
|
||||
WebDriverWait(self.driver, 30).until(
|
||||
WebDriverWait(self.driver, 15).until(
|
||||
EC.presence_of_element_located(("xpath", '//*[@id="responsive_page_template_content"]/div[1]/div[1]/div/div/div/div[2]/div/form/div[1]/input'))
|
||||
)
|
||||
|
||||
@@ -99,7 +108,7 @@ class SteamLogin():
|
||||
if is_family:
|
||||
self.__wait_get('//*[@id="account_pulldown"]').click()
|
||||
self.__wait_get('//*[@id="account_dropdown"]/div/a[last()]').click()
|
||||
self.driver.get("https://steamcommunity.com/login/home/?goto=")
|
||||
self.__restart_driver()
|
||||
self.__write_to_json(account)
|
||||
logger.info(f"Вход для аккаунта {username} не удался. Ошибка: семейный доступ")
|
||||
continue
|
||||
@@ -115,6 +124,8 @@ class SteamLogin():
|
||||
WebDriverWait(self.driver, 10).until(
|
||||
EC.presence_of_element_located(('xpath', '//*[@id="main_content"]/div[2]/div/div[2]/div[3]/div[5]/div[2]/a'))
|
||||
).click()
|
||||
|
||||
# ключевой момент
|
||||
WebDriverWait(self.driver, 10).until(
|
||||
EC.presence_of_element_located(('xpath', '//*[@id="email_authenticator_form"]/div/div[2]/label'))
|
||||
).click()
|
||||
@@ -123,7 +134,7 @@ class SteamLogin():
|
||||
if is_red:
|
||||
self.__wait_get('//*[@id="account_pulldown"]').click()
|
||||
self.__wait_get('//*[@id="account_dropdown"]/div/a[last()]').click()
|
||||
self.driver.get("https://steamcommunity.com/login/home/?goto=")
|
||||
self.__restart_driver()
|
||||
self.__write_to_json(account)
|
||||
logger.info(f"Вход для аккаунта {username} не удался. Ошибка: красная табличка")
|
||||
continue
|
||||
@@ -145,5 +156,5 @@ class SteamLogin():
|
||||
|
||||
# Возвращаемся на страницу входа для следующего аккаунта
|
||||
self.__write_to_json(account)
|
||||
self.driver.get("https://steamcommunity.com/login/home/?goto=")
|
||||
self.__restart_driver()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user