@@ -215,14 +215,44 @@ def live_count(): # Print Live count of participants
215
215
print (f'{ "Live count of participants: " + live_count .number_of_participants + " " } \r ' , end = '' , flush = True ) # Prints the live count
216
216
time .sleep (0.5 )
217
217
218
+ except NoSuchElementException : # An exception if Network change is detected.
219
+ try :
220
+ connection_lost = driver .find_element_by_class_name ("RkzbPb" ).text
221
+ if "You lost your network connection. Trying to reconnect." in connection_lost :
222
+ try :
223
+ WebDriverWait (driver , 180 ).until (expected_conditions .presence_of_element_located ((By .CLASS_NAME , "crqnQb" )))
224
+ except TimeoutException :
225
+ print ("Please check your Internet connection and Re-Start the Automeet." )
226
+ exit_now ()
227
+ except NoSuchElementException :
228
+ live_count ()
229
+ pass
230
+
231
+ def exit_checker ():
232
+ try :
218
233
# Several Participants left the meeting or recording Stopped.
219
234
try :
220
- live_count .left_or_rec_stop = driver .find_element_by_class_name ("aGJE1b" ).text
235
+ exit_checker .left_or_rec_stop = driver .find_element_by_class_name ("aGJE1b" ).text
221
236
except NoSuchElementException :
222
237
pass
223
238
except StaleElementReferenceException :
224
239
try :
225
- live_count .left_or_rec_stop = driver .find_element_by_class_name ("aGJE1b" ).text
240
+ exit_checker .left_or_rec_stop = driver .find_element_by_class_name ("aGJE1b" ).text
241
+ except NoSuchElementException :
242
+ pass
243
+ except WebDriverException as e :
244
+ if "not connected to DevTools" in e :
245
+ print ("Please check your Internet connection and Re-Start the Automeet." )
246
+ exit_now ()
247
+
248
+ # Your host ended the meeting for everyone.
249
+ try :
250
+ exit_checker .host_end_meeting = driver .find_element_by_class_name ("CRFCdf" ).text
251
+ except NoSuchElementException :
252
+ pass
253
+ except StaleElementReferenceException :
254
+ try :
255
+ exit_checker .host_end_meeting = driver .find_element_by_class_name ("CRFCdf" ).text
226
256
except NoSuchElementException :
227
257
pass
228
258
except WebDriverException as e :
@@ -246,7 +276,7 @@ def live_count(): # Print Live count of participants
246
276
247
277
def end_class (did_host_end ): # Ends the current session
248
278
live_count .max_count = 0
249
- live_count .left_or_rec_stop = ""
279
+ exit_checker .left_or_rec_stop = ""
250
280
time .sleep (10 )
251
281
if not did_host_end :
252
282
# Clicks leave call button
@@ -323,20 +353,18 @@ def exit_now(): # Exits the script
323
353
"profile.default_content_setting_values.geolocation" : 2 ,
324
354
"profile.default_content_setting_values.notifications" : 2 })
325
355
326
- driverPath = 'chromedriver.exe'
327
-
328
356
try :
329
357
try :
330
358
# For Chrome
331
- driver = webdriver .Chrome (executable_path = resource_path (driverPath ), options = options )
359
+ driver = webdriver .Chrome (executable_path = resource_path ('chromedriver.exe' ), options = options )
332
360
except WebDriverException :
333
361
try :
334
362
# For 64 Bit Brave
335
363
options .binary_location = "C:\\ Program Files\\ BraveSoftware\\ Brave-Browser\\ Application\\ brave.exe"
336
364
except WebDriverException :
337
365
# For 32 Bit Brave
338
366
options .binary_location = "C:\\ Program Files (x86)\\ BraveSoftware\\ Brave-Browser\\ Application\\ brave.exe"
339
- driver = webdriver .Chrome (options = options , executable_path = resource_path (driverPath ))
367
+ driver = webdriver .Chrome (options = options , executable_path = resource_path ('chromedriver.exe' ))
340
368
except FileNotFoundError :
341
369
print ("Webdriver seems to be outdated, download the LATEST VERSION of AUTOMEET from here: "
342
370
"'https://github.com/pixincreate/Automeet/releases/latest'" , end = '\n ' )
@@ -379,7 +407,7 @@ def exit_now(): # Exits the script
379
407
# Declarations
380
408
lastClass = False
381
409
live_count .max_count = 0
382
- live_count .left_or_rec_stop = live_count .rec_button = scheduledTimeInSeconds = classTime = classTitle = ""
410
+ exit_checker .left_or_rec_stop = exit_checker . host_end_meeting = live_count .rec_button = scheduledTimeInSeconds = classTime = classTitle = ""
383
411
384
412
# Deleting the user data, i.e., taken in the beginning
385
413
del USERNAME , PASSWORD
@@ -520,9 +548,9 @@ def exit_now(): # Exits the script
520
548
# Ends session when either of the condition is satisfied
521
549
while True :
522
550
live_count ()
523
-
551
+ exit_checker ()
524
552
try :
525
- if "Your host ended the meeting for everyone" in driver . find_element_by_class_name ( "CRFCdf" ) :
553
+ if "Your host ended the meeting for everyone" in exit_checker . host_end_meeting :
526
554
print ('Meeting will end now as Host ended the meeting.' , end = '\r ' , flush = True )
527
555
host_ended = 1
528
556
end_class (host_ended )
@@ -532,12 +560,12 @@ def exit_now(): # Exits the script
532
560
host_ended = 0
533
561
end_class (host_ended )
534
562
break
535
- elif "Several participants left the meeting." in live_count .left_or_rec_stop :
563
+ elif "Several participants left the meeting." in exit_checker .left_or_rec_stop :
536
564
print ('Meeting will end now as Several participants left the meeting.' , end = '\r ' , flush = True )
537
565
host_ended = 0
538
566
end_class (host_ended )
539
567
break
540
- elif "stopped recording" in live_count .left_or_rec_stop :
568
+ elif "stopped recording" in exit_checker .left_or_rec_stop :
541
569
print ('Meeting will end now as the recording stopped.' , end = '\r ' , flush = True )
542
570
host_ended = 0
543
571
end_class (host_ended )
0 commit comments