leesj-dev / classroom-notifier

Classroom Notifier aims to send automated notification emails when any post in a Google Classroom is edited or deleted.
1 stars 0 forks source link

[URGENT] A major malfunction detected #16

Open museyooni opened 2 years ago

museyooni commented 2 years ago

I received more than 100 mails that notify me classroom posts are edited or deleted in multiple classrooms, however posts are not even changed a bit. There was no error message regarding mail sending, but 5~6 of 'change detected' or 'deletion detected', and it seems nonsense to get more than 100 mails which have all different notifications. Also, I got a new error message and I tried to copy here, and unfortunately, I lost it because copy and paste didn't worked for terminal.

I'm trying to resume these errors. I will inform you ASAP when I get specific error message.

leesj-dev commented 2 years ago

Ok. I haven't found the exact reason why this is happening. I will figure out for a solution ASAP.

leesj-dev commented 2 years ago

Image 2022-07-26 at 2 34 PM

It is very odd, given that the bugs are not reproduced in my mac.

leesj-dev commented 2 years ago

Image 2022-07-26 at 2 44 PM Currently running through Terminal and I am not facing any errors yet. I am keep tracking for errors.

leesj-dev commented 2 years ago

Ok I found an error suddenly. The full code is the following:

[2]    exit 1     python3 /Users/leesj/Documents/VS\ Code/classroom-notifier/src/main.py 1
leesj@iseungjun-ui-MacBookPro classroom-notifier % 변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
leesj@iseungjun-ui-MacBookPro classroom-notifier % 변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
leesj@iseungjun-ui-MacBookPro classroom-notifier % 변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
leesj@iseungjun-ui-MacBookPro classroom-notifier % 변경된 게시물 감지.
메일 발신 완료.
변경된 게시물 감지.
변경된 게시물 감지.
메일 발신 완료.
메일 발신 완료.
변경된 게시물 감지.
메일 발신 완료.
변경사항 없음.
변경사항 없음.
변경사항 없음.
변경사항 없음.
삭제된 게시물 감지.
메일 발신 완료.
삭제된 게시물 감지.
삭제된 게시물 감지.
메일 발신 완료.
메일 발신 완료.
삭제된 게시물 감지.
메일 발신 완료.
leesj@iseungjun-ui-MacBookPro classroom-notifier % 변경된 게시물 감지.
변경된 게시물 감지.
변경된 게시물 감지.
Traceback (most recent call last):
  File "/Users/leesj/Documents/VS Code/classroom-notifier/src/main.py", line 404, in <module>
    MsgEdited()
  File "/Users/leesj/Documents/VS Code/classroom-notifier/src/main.py", line 347, in MsgEdited
    elementFinder(key_str, "main", "/div[1]/div[1]/div[4]/div/div/div", "click")
  File "/Users/leesj/Documents/VS Code/classroom-notifier/src/main.py", line 91, in elementFinder
    result = driver.find_element(By.XPATH, total).click()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py", line 88, in click
    self._execute(Command.CLICK_ELEMENT)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py", line 396, in _execute
    return self._parent.execute(command, params)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 435, in execute
    self.error_handler.check_response(response)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementClickInterceptedException: Message: element click intercepted: Element <div jsshadow="" role="button" class="U26fgb JRtysb WzwrXb I12f0b K2mXPb" jscontroller="iSvg6e" jsaction="click:cOuCgd; mousedown:UX7yZ; mouseup:lbsD7e; mouseenter:tfO1Yc; mouseleave:JywGue; focus:AHmuwe; blur:O22p3e; contextmenu:mg9Pef;touchstart:p6p2H; touchmove:FwuNnf; touchend:yfqBxc(preventMouseEvents=true|preventDefault=true); touchcancel:JMtRjd;keydown:I481le" jsname="LgbsSe" tabindex="0" aria-haspopup="true" aria-expanded="false" data-dynamic="true" data-alignright="true" aria-label="공지 옵션">...</div> is not clickable at point (1063, 20). Other element would receive the click: <div class="gb_Vd gb_Xa gb_Kd" ng-non-bindable="" data-ogsr-up="">...</div>
  (Session info: chrome=103.0.5060.134)
Stacktrace:
0   chromedriver                        0x000000010aea6ef9 chromedriver [+ 4480761](tel:+ 4480761)
1   chromedriver                        0x000000010ae325d3 chromedriver [+ 4003283](tel:+ 4003283)
2   chromedriver                        0x000000010aac5338 chromedriver + 410424
3   chromedriver                        0x000000010ab02cc2 chromedriver + 662722
4   chromedriver                        0x000000010ab00883 chromedriver + 653443
5   chromedriver                        0x000000010aafded4 chromedriver + 642772
6   chromedriver                        0x000000010aafcc92 chromedriver + 638098
7   chromedriver                        0x000000010aaf0939 chromedriver + 588089
8   chromedriver                        0x000000010ab18a62 chromedriver [+ 752226](tel:+ 752226)
9   chromedriver                        0x000000010aaf01f5 chromedriver + 586229
10  chromedriver                        0x000000010ab18b6e chromedriver [+ 752494](tel:+ 752494)
11  chromedriver                        0x000000010ab2b4f1 chromedriver + 828657
12  chromedriver                        0x000000010ab18953 chromedriver [+ 751955](tel:+ 751955)
13  chromedriver                        0x000000010aaeecd5 chromedriver + 580821
14  chromedriver                        0x000000010aaefd25 chromedriver + 584997
15  chromedriver                        0x000000010ae7802d chromedriver + 4288557
16  chromedriver                        0x000000010ae7d1b3 chromedriver [+ 4309427](tel:+ 4309427)
17  chromedriver                        0x000000010ae8223f chromedriver [+ 4330047](tel:+ 4330047)
18  chromedriver                        0x000000010ae7ddfa chromedriver [+ 4312570](tel:+ 4312570)
19  chromedriver                        0x000000010ae56fef chromedriver [+ 4153327](tel:+ 4153327)
20  chromedriver                        0x000000010ae97d78 chromedriver [+ 4418936](tel:+ 4418936)
21  chromedriver                        0x000000010ae97eff chromedriver [+ 4419327](tel:+ 4419327)
22  chromedriver                        0x000000010aeaeab5 chromedriver [+ 4512437](tel:+ 4512437)
23  libsystem_pthread.dylib             0x00007ff8121544e1 _pthread_start + 125
24  libsystem_pthread.dylib             0x00007ff81214ff6b thread_start + 15

변경된 게시물 감지.

[6]  + exit 1     python3 /Users/leesj/Documents/VS\ Code/classroom-notifier/src/main.py 5
leesj@iseungjun-ui-MacBookPro classroom-notifier % Traceback (most recent call last):
  File "/Users/leesj/Documents/VS Code/classroom-notifier/src/main.py", line 404, in <module>
    MsgEdited()
  File "/Users/leesj/Documents/VS Code/classroom-notifier/src/main.py", line 352, in MsgEdited
    elementFinder(key_str, "link_copy", "", "click")
  File "/Users/leesj/Documents/VS Code/classroom-notifier/src/main.py", line 91, in elementFinder
    result = driver.find_element(By.XPATH, total).click()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py", line 88, in click
    self._execute(Command.CLICK_ELEMENT)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py", line 396, in _execute
    return self._parent.execute(command, params)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 435, in execute
    self.error_handler.check_response(response)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
  (Session info: chrome=103.0.5060.134)
Stacktrace:
0   chromedriver                        0x0000000108bafef9 chromedriver [+ 4480761](tel:+ 4480761)
1   chromedriver                        0x0000000108b3b5d3 chromedriver [+ 4003283](tel:+ 4003283)
2   chromedriver                        0x00000001087ce1ef chromedriver + 410095
3   chromedriver                        0x0000000108805737 chromedriver + 636727
4   chromedriver                        0x00000001087f9939 chromedriver + 588089
5   chromedriver                        0x0000000108821a62 chromedriver [+ 752226](tel:+ 752226)
6   chromedriver                        0x00000001087f91f5 chromedriver + 586229
7   chromedriver                        0x0000000108821b6e chromedriver [+ 752494](tel:+ 752494)
8   chromedriver                        0x00000001088344f1 chromedriver + 828657
9   chromedriver                        0x0000000108821953 chromedriver [+ 751955](tel:+ 751955)
10  chromedriver                        0x00000001087f7cd5 chromedriver + 580821
11  chromedriver                        0x00000001087f8d25 chromedriver + 584997
12  chromedriver                        0x0000000108b8102d chromedriver + 4288557
13  chromedriver                        0x0000000108b861b3 chromedriver [+ 4309427](tel:+ 4309427)
14  chromedriver                        0x0000000108b8b23f chromedriver [+ 4330047](tel:+ 4330047)
15  chromedriver                        0x0000000108b86dfa chromedriver [+ 4312570](tel:+ 4312570)
16  chromedriver                        0x0000000108b5ffef chromedriver [+ 4153327](tel:+ 4153327)
17  chromedriver                        0x0000000108ba0d78 chromedriver [+ 4418936](tel:+ 4418936)
18  chromedriver                        0x0000000108ba0eff chromedriver [+ 4419327](tel:+ 4419327)
19  chromedriver                        0x0000000108bb7ab5 chromedriver [+ 4512437](tel:+ 4512437)
20  libsystem_pthread.dylib             0x00007ff8121544e1 _pthread_start + 125
21  libsystem_pthread.dylib             0x00007ff81214ff6b thread_start + 15

[4]  - exit 1     python3 /Users/leesj/Documents/VS\ Code/classroom-notifier/src/main.py 3
leesj@iseungjun-ui-MacBookPro classroom-notifier % Traceback (most recent call last):
  File "/Users/leesj/Documents/VS Code/classroom-notifier/src/main.py", line 404, in <module>
    MsgEdited()
  File "/Users/leesj/Documents/VS Code/classroom-notifier/src/main.py", line 352, in MsgEdited
    elementFinder(key_str, "link_copy", "", "click")
  File "/Users/leesj/Documents/VS Code/classroom-notifier/src/main.py", line 91, in elementFinder
    result = driver.find_element(By.XPATH, total).click()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py", line 88, in click
    self._execute(Command.CLICK_ELEMENT)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py", line 396, in _execute
    return self._parent.execute(command, params)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 435, in execute
    self.error_handler.check_response(response)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
  (Session info: chrome=103.0.5060.134)
Stacktrace:
0   chromedriver                        0x0000000103da1ef9 chromedriver [+ 4480761](tel:+ 4480761)
1   chromedriver                        0x0000000103d2d5d3 chromedriver [+ 4003283](tel:+ 4003283)
2   chromedriver                        0x00000001039c01ef chromedriver + 410095
3   chromedriver                        0x00000001039f7737 chromedriver + 636727
4   chromedriver                        0x00000001039eb939 chromedriver + 588089
5   chromedriver                        0x0000000103a13a62 chromedriver [+ 752226](tel:+ 752226)
6   chromedriver                        0x00000001039eb1f5 chromedriver + 586229
7   chromedriver                        0x0000000103a13b6e chromedriver [+ 752494](tel:+ 752494)
8   chromedriver                        0x0000000103a264f1 chromedriver + 828657
9   chromedriver                        0x0000000103a13953 chromedriver [+ 751955](tel:+ 751955)
10  chromedriver                        0x00000001039e9cd5 chromedriver + 580821
11  chromedriver                        0x00000001039ead25 chromedriver + 584997
12  chromedriver                        0x0000000103d7302d chromedriver + 4288557
13  chromedriver                        0x0000000103d781b3 chromedriver [+ 4309427](tel:+ 4309427)
14  chromedriver                        0x0000000103d7d23f chromedriver [+ 4330047](tel:+ 4330047)
15  chromedriver                        0x0000000103d78dfa chromedriver [+ 4312570](tel:+ 4312570)
16  chromedriver                        0x0000000103d51fef chromedriver [+ 4153327](tel:+ 4153327)
17  chromedriver                        0x0000000103d92d78 chromedriver [+ 4418936](tel:+ 4418936)
18  chromedriver                        0x0000000103d92eff chromedriver [+ 4419327](tel:+ 4419327)
19  chromedriver                        0x0000000103da9ab5 chromedriver [+ 4512437](tel:+ 4512437)
20  libsystem_pthread.dylib             0x00007ff8121544e1 _pthread_start + 125
21  libsystem_pthread.dylib             0x00007ff81214ff6b thread_start + 15

[3]  - exit 1     python3 /Users/leesj/Documents/VS\ Code/classroom-notifier/src/main.py 2
leesj@iseungjun-ui-MacBookPro classroom-notifier % Traceback (most recent call last):
  File "/Users/leesj/Documents/VS Code/classroom-notifier/src/main.py", line 404, in <module>
    MsgEdited()
  File "/Users/leesj/Documents/VS Code/classroom-notifier/src/main.py", line 352, in MsgEdited
    elementFinder(key_str, "link_copy", "", "click")
  File "/Users/leesj/Documents/VS Code/classroom-notifier/src/main.py", line 91, in elementFinder
    result = driver.find_element(By.XPATH, total).click()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py", line 88, in click
    self._execute(Command.CLICK_ELEMENT)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webelement.py", line 396, in _execute
    return self._parent.execute(command, params)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/webdriver.py", line 435, in execute
    self.error_handler.check_response(response)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
  (Session info: chrome=103.0.5060.134)
Stacktrace:
0   chromedriver                        0x000000010950def9 chromedriver [+ 4480761](tel:+ 4480761)
1   chromedriver                        0x00000001094995d3 chromedriver [+ 4003283](tel:+ 4003283)
2   chromedriver                        0x000000010912c1ef chromedriver + 410095
3   chromedriver                        0x0000000109163737 chromedriver + 636727
4   chromedriver                        0x0000000109157939 chromedriver + 588089
5   chromedriver                        0x000000010917fa62 chromedriver [+ 752226](tel:+ 752226)
6   chromedriver                        0x00000001091571f5 chromedriver + 586229
7   chromedriver                        0x000000010917fb6e chromedriver [+ 752494](tel:+ 752494)
8   chromedriver                        0x00000001091924f1 chromedriver + 828657
9   chromedriver                        0x000000010917f953 chromedriver [+ 751955](tel:+ 751955)
10  chromedriver                        0x0000000109155cd5 chromedriver + 580821
11  chromedriver                        0x0000000109156d25 chromedriver + 584997
12  chromedriver                        0x00000001094df02d chromedriver + 4288557
13  chromedriver                        0x00000001094e41b3 chromedriver [+ 4309427](tel:+ 4309427)
14  chromedriver                        0x00000001094e923f chromedriver [+ 4330047](tel:+ 4330047)
15  chromedriver                        0x00000001094e4dfa chromedriver [+ 4312570](tel:+ 4312570)
16  chromedriver                        0x00000001094bdfef chromedriver [+ 4153327](tel:+ 4153327)
17  chromedriver                        0x00000001094fed78 chromedriver [+ 4418936](tel:+ 4418936)
18  chromedriver                        0x00000001094feeff chromedriver [+ 4419327](tel:+ 4419327)
19  chromedriver                        0x0000000109515ab5 chromedriver [+ 4512437](tel:+ 4512437)
20  libsystem_pthread.dylib             0x00007ff8121544e1 _pthread_start + 125
21  libsystem_pthread.dylib             0x00007ff81214ff6b thread_start + 15

[5]  + exit 1     python3 /Users/leesj/Documents/VS\ Code/classroom-notifier/src/main.py 4
leesj-dev commented 2 years ago

It’s a “Element not clickable” exception, it’s because I clicked on other programs while executing the code.

museyooni commented 2 years ago

Did you get multiple emails like me? image

leesj-dev commented 2 years ago

i disabled the email send code smtp.sendmail(naver_id, google_id, msg.as_string()) by adding a # to make it a comment before running the shell script, so the emails did not arrive.

leesj-dev commented 2 years ago

Ok, something happened when I was operating on a different program.

pdict_before =  {1: ('공지', '정용호', '3월 30일', '* 18기 3학년1학기 기하(정용호T) 수업참여 학생들 중<br>&nbsp; &nbsp;원격수업이 필요한 학생은&nbsp;<br>&nbsp; &nbsp;쌍곡선과 직선 수업동영상 학습에&nbsp;참여바랍니다.<br>* <b>차시예고: P.48~ 중단원, 대단원 마무리는 노트에 필이 후 검사받음</b>', '* 18기 3학년1학기 기하(정용호T) 수업참여 학생들 중\n   원격수업이 필요한 학생은 \n   쌍곡선과 직선 수업동영상 학습에 참여바랍니다.\n* 차시예고: P.48~ 중단원, 대단원 마무리는 노트에 필이 후 검사받음', ('https://drive.google.com/file/d/1PCklBUoFNss2hOZlnuHK1MOg4j1M6Ytn/view?usp=drive_web&authuser=0',))} 

pdict_after =  {1: ('공지', '정용호', '3월 30일', '* 18기 3학년1학기 기하(정용호T) 수업참여 학생들 중<br>&nbsp; &nbsp;원격수업이 필요한 학생은&nbsp;<br>&nbsp; &nbsp;쌍곡선과 직선 수업동영상 학습에&nbsp;참여바랍니다.<br>* <b>차시예고: P.48~ 중단원, 대단원 마무리는 노트에 필이 후 검사받음</b>', '* 18기 3학년1학기 기하(정용호T) 수업참여 학생들 중\n   원격수업이 필요한 학생은 \n   쌍곡선과 직선 수업동영상 학습에 참여바랍니다.\n* 차시예고: P.48~ 중단원, 대단원 마무리는 노트에 필이 후 검사받음', ())}

The only difference is the LINK (attachment). The attachExtractor did not work when I was using a different program on my Mac.

leesj-dev commented 2 years ago

One more error happened; this time, pdict_after={}. Now we get WHY you received a bunch of emails – it’s because nothing was detected in pdict_after. We now have to solve how to fix these issues.

leesj-dev commented 2 years ago

Check google classroom for updated info.

leesj-dev commented 2 years ago

Try it one more time with the updated code. You may have to change the other files too, such as config.yaml, because most of the other files have been changed.

leesj-dev commented 2 years ago

To address the known issues as of now,

  1. ElementClickIntrceptedException → we would replace every click() to send.keys(return) instead.
  2. Detecting nothing in the page → we would have to check if certain element exists or change the time of implicity_wait.
  3. Unable to find the element of the classroom name → since this must exist, we would use presenceOfElementLocated() or visibilityOfElementLocated() to wait until the element loads.

I will try these solutions later to see if the bugs can be fixed.

museyooni commented 2 years ago

To address the known issues as of now,

  1. ElementClickIntrceptedException → we would replace every click() to send.keys(return) instead.

  2. Detecting nothing in the page → we would have to check if certain element exists or change the time of implicity_wait.

  3. Unable to find the element of the classroom name → since this must exist, we would use presenceOfElementLocated() or visibilityOfElementLocated() to wait until the element loads.

I will try these solutions later to see if the bugs can be fixed.

Great. If this solutions work, there is no need to make more sessions which cause higher CPU usage.