Skip to content

Commit b9dd569

Browse files
Chessbot 1.1.1
Fixed a bug that caused the bot not to connect to the account
1 parent 35c2300 commit b9dd569

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

ChessBot.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,16 @@ def login(self) -> None:
6161
self.__drivers.get('https://www.chess.com/login')
6262
while True:
6363
try:
64-
bottom_banner = EC.presence_of_element_located((By.CLASS_NAME, 'bottom-banner-close'))
65-
WebDriverWait(self.__drivers, 1).until(bottom_banner)
64+
login_button = EC.presence_of_element_located((By.ID, 'login'))
65+
WebDriverWait(self.__drivers, 1).until(login_button)
6666
break
6767
except: pass
6868

69-
self.__drivers.find_element(By.CLASS_NAME, 'bottom-banner-close').click()
69+
try:
70+
bottom_banner = EC.presence_of_element_located((By.CLASS_NAME, 'bottom-banner-close'))
71+
WebDriverWait(self.__drivers, 3).until(bottom_banner)
72+
self.__drivers.find_element(By.CLASS_NAME, 'bottom-banner-close').click()
73+
except: pass
7074

7175
self.__drivers.find_element(By.ID, 'username').send_keys(self.__login)
7276
self.__drivers.find_element(By.ID, 'password').send_keys(self.__password)
@@ -285,7 +289,6 @@ def startNewGame(self):
285289

286290
while True:
287291
end_game, results = bot.isGameEnded(opponent_name, game)
288-
#print(end_game, results)
289292
if end_game:
290293
if results == "win":
291294
wins += 1

0 commit comments

Comments
 (0)