Skip to content
This repository was archived by the owner on Jul 4, 2024. It is now read-only.

Commit f83be54

Browse files
authored
Update Automeet.py
Hotfix for login problem
1 parent 61f524c commit f83be54

1 file changed

Lines changed: 17 additions & 8 deletions

File tree

Source/Automeet.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,22 @@ def login(username, password): # Logs in the user
7777
'1d95ddb5dea5225%22%2C%22cdl%22%3Anull%2C%22cid%22%3A%22717762328687-iludtf96g1hinl76e4lc1b9a82g457nn.apps.googleusercontent.com%22%'
7878
'2C%22k%22%3A%22Google%22%2C%22ses%22%3A%2226bafb488fcc494f92c896ee923849b6%22%7D&response_type=code&flowName=GeneralOAuthFlow')
7979

80-
driver.find_element_by_name("identifier").send_keys(username)
81-
WebDriverWait(driver, 10).until(expected_conditions.element_to_be_clickable((By.XPATH, "//*[@id='identifierNext']/div/button/div[2]"))).click()
80+
try:
81+
WebDriverWait(driver, 60).until(expected_conditions.presence_of_element_located((By.NAME, "identifier"))).send_keys(username)
82+
except TimeoutException:
83+
print("Your internet seems to be slow, check and Re-Start the Automeet.")
84+
exit_now()
85+
# driver.find_element_by_name("identifier").send_keys(username)
86+
WebDriverWait(driver, 60).until(expected_conditions.element_to_be_clickable((By.XPATH, "//*[@id='identifierNext']/div/button/div[2]"))).click()
8287
driver.implicitly_wait(10)
8388

8489
try:
85-
driver.find_element_by_name("password").send_keys(password)
86-
WebDriverWait(driver, 2).until(expected_conditions.element_to_be_clickable((By.XPATH, "//*[@id='passwordNext']/div/button/div[2]"))).click()
90+
try:
91+
WebDriverWait(driver, 60).until(expected_conditions.presence_of_element_located((By.NAME, "password"))).send_keys(password)
92+
except TimeoutException:
93+
print("Your internet seems to be slow, check and Re-Start the Automeet.")
94+
exit_now()
95+
WebDriverWait(driver, 5).until(expected_conditions.element_to_be_clickable((By.XPATH, "//*[@id='passwordNext']/div/button/div[2]"))).click()
8796
except TimeoutException:
8897
print('\nUsername/Password seems to be incorrect, please re-check\nand Re-Run the program.')
8998
del username, password
@@ -93,7 +102,7 @@ def login(username, password): # Logs in the user
93102
del username, password
94103
exit_now()
95104
try:
96-
WebDriverWait(driver, 6).until(lambda webpage: "https://stackoverflow.com/" in webpage.current_url)
105+
WebDriverWait(driver, 60).until(lambda webpage: "https://stackoverflow.com/" in webpage.current_url) # 6 was before
97106
print('\nLogin Successful!\n')
98107
except TimeoutException:
99108
print('\nUsername/Password seems to be incorrect, please re-check\nand Re-Run the program.')
@@ -169,14 +178,14 @@ def auto_close_popup_message(): # Closes the pop-up message in the browser
169178
def live_count(): # Print Live count of participants
170179
try:
171180
try:
172-
driver.implicitly_wait(6)
181+
driver.implicitly_wait(60)
173182
live_count.number_of_participants = driver.find_element_by_class_name("ZaI3hb").find_element_by_class_name("wnPUne").text
174183

175184
if live_count.number_of_participants == '':
176185
live_count.number_of_participants = driver.find_element_by_class_name("rua5Nb").text.strip("()")
177186

178187
except StaleElementReferenceException:
179-
driver.implicitly_wait(6)
188+
driver.implicitly_wait(60)
180189
live_count.number_of_participants = driver.find_element_by_class_name("ZaI3hb").find_element_by_class_name("wnPUne").text
181190

182191
if live_count.number_of_participants == '':
@@ -504,6 +513,6 @@ def exit_now(): # Exits the script
504513
auto_close_popup_message()
505514
except JavascriptException:
506515
pass
507-
print('\nLast session ended.\n')
516+
print('Last session ended.\n')
508517
time.sleep(5)
509518
exit_now()

0 commit comments

Comments
 (0)