shine-jayakumar/insta-likecom-bot

Crash Liking Story - [*] => Error: [NoSuchElementException] - Message: no such element: Unable to locate element: {"method":"css selector","selector":"._abx4"}

ap0l0 opened this issue · 0 comments

ap0l0 commented

Command Used:
python3 ilcbot.py -pr /Users/user/Documents/ig-zerg-old/profiles/lifestyle-verified6.json -lm limits.json
I think it happens when some users have the option to reply the story disabled:
image

@shine-jayakumar can you make the script in cases like this to ignore the error and continue to the next user/target instead of closing the script?



(ig) ➜  insta-likecom-bot git:(master) ✗ python3 ilcbot.py -pr /Users/user/Documents/ig-zerg-old/profiles/lifestyle_miami-verified6.json -lm limits.json                                  [23/12/2|10:19AM]

     ___ _  _ ___ _____ _      _    ___ _  _____ ___ ___  __  __     ___  ___ _____
    |_ _| \| / __|_   _/_\ ___| |  |_ _| |/ | __/ __/ _ \|  \/  |___| _ )/ _ |_   _|
     | || .` \__ \ | |/ _ |___| |__ | || ' <| _| (_| (_) | |\/| |___| _ | (_) || |
    |___|_|\_|___/ |_/_/ \_\  |____|___|_|\_|___\___\___/|_|  |_|   |___/\___/ |_|

    insta-likecom-bot v.3.0.4
    Automates likes and comments on an instagram account or tag

    Author: Shine Jayakumar
    Github: https://github.com/shine-jayakumar
    Copyright (c) 2023 Shine Jayakumar
    LICENSE: MIT


[*] => Script started
[*] => Downloading webdriver for your version of Chrome
[*] => Loading Instagram
[*] => Delay: 3-15 secs
[*] => Max. comments to like: 2
[*] => Using profile: /Users/user/Library/Application Support/Google/Chrome/Default
[*] => Launching Instagram
[*] => [launch_insta]: Attempt - 1
[*] => Checking if user is already logged in
[*] => [Attempt# 1] Validating login
[*] => Setting target to: cindyfabbri
[*] => [target: cindyfabbri] Opening target
[*] => [open_target]: Attempt - 1
[*] => [is_private]: text=>(This account is private) not found
[*] => [is_private]: text=>(This Account is private) not found
[*] => [is_private]: text=>(This Account is Private) not found
[*] => Script ended with error
[*] => Error: [NoSuchElementException] - Message: no such element: Unable to locate element: {"method":"css selector","selector":"._abx4"}
  (Session info: chrome=119.0.6045.199); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
Stacktrace:
0   chromedriver                        0x0000000105a11d28 chromedriver + 4795688
1   chromedriver                        0x0000000105a092b3 chromedriver + 4760243
2   chromedriver                        0x00000001055e288d chromedriver + 407693
3   chromedriver                        0x00000001056313d9 chromedriver + 730073
4   chromedriver                        0x0000000105631591 chromedriver + 730513
5   chromedriver                        0x00000001056777e4 chromedriver + 1017828
6   chromedriver                        0x0000000105658ccd chromedriver + 892109
7   chromedriver                        0x0000000105674b2b chromedriver + 1006379
8   chromedriver                        0x0000000105658a73 chromedriver + 891507
9   chromedriver                        0x0000000105623143 chromedriver + 672067
10  chromedriver                        0x000000010562431e chromedriver + 676638
11  chromedriver                        0x00000001059d2795 chromedriver + 4536213
12  chromedriver                        0x00000001059d7853 chromedriver + 4556883
13  chromedriver                        0x00000001059b8001 chromedriver + 4427777
14  chromedriver                        0x00000001059d859d chromedriver + 4560285
15  chromedriver                        0x00000001059a948c chromedriver + 4367500
16  chromedriver                        0x00000001059f80e8 chromedriver + 4690152
17  chromedriver                        0x00000001059f829e chromedriver + 4690590
18  chromedriver                        0x0000000105a08eee chromedriver + 4759278
19  libsystem_pthread.dylib             0x00007ff813cce1d3 _pthread_start + 125
20  libsystem_pthread.dylib             0x00007ff813cc9bd3 thread_start + 15
Traceback (most recent call last):
  File "/Users/user/Downloads/insta-likecom-bot/modules/insta.py", line 747, in like_story
    wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, '._abx4'))).find_element(By.CSS_SELECTOR, 'svg[aria-label="Like"]').click()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/anaconda3/envs/ig/lib/python3.11/site-packages/selenium/webdriver/support/wait.py", line 95, in until
    raise TimeoutException(message, screen, stacktrace)
selenium.common.exceptions.TimeoutException: Message:
Stacktrace:
0   chromedriver                        0x0000000105a11d28 chromedriver + 4795688
1   chromedriver                        0x0000000105a092b3 chromedriver + 4760243
2   chromedriver                        0x00000001055e288d chromedriver + 407693
3   chromedriver                        0x00000001056313d9 chromedriver + 730073
4   chromedriver                        0x0000000105631591 chromedriver + 730513
5   chromedriver                        0x00000001056777e4 chromedriver + 1017828
6   chromedriver                        0x0000000105658ccd chromedriver + 892109
7   chromedriver                        0x0000000105674b2b chromedriver + 1006379
8   chromedriver                        0x0000000105658a73 chromedriver + 891507
9   chromedriver                        0x0000000105623143 chromedriver + 672067
10  chromedriver                        0x000000010562431e chromedriver + 676638
11  chromedriver                        0x00000001059d2795 chromedriver + 4536213
12  chromedriver                        0x00000001059d7853 chromedriver + 4556883
13  chromedriver                        0x00000001059b8001 chromedriver + 4427777
14  chromedriver                        0x00000001059d859d chromedriver + 4560285
15  chromedriver                        0x00000001059a948c chromedriver + 4367500
16  chromedriver                        0x00000001059f80e8 chromedriver + 4690152
17  chromedriver                        0x00000001059f829e chromedriver + 4690590
18  chromedriver                        0x0000000105a08eee chromedriver + 4759278
19  libsystem_pthread.dylib             0x00007ff813cce1d3 _pthread_start + 125
20  libsystem_pthread.dylib             0x00007ff813cc9bd3 thread_start + 15


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/user/Downloads/insta-likecom-bot/ilcbot.py", line 137, in <module>
    Story(insta, profile, is_private=private_account, logger=logger).interact(target, stats)
  File "/Users/user/Downloads/insta-likecom-bot/modules/instaworkflows.py", line 83, in interact
    if self.insta.like_story():
       ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/Downloads/insta-likecom-bot/modules/insta.py", line 750, in like_story
    if self.driver.find_element(By.CSS_SELECTOR, '._abx4').find_element(By.CSS_SELECTOR, 'svg[aria-label="Unlike"]'):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/anaconda3/envs/ig/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 739, in find_element
    return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/anaconda3/envs/ig/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 345, in execute
    self.error_handler.check_response(response)
  File "/usr/local/anaconda3/envs/ig/lib/python3.11/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"._abx4"}
  (Session info: chrome=119.0.6045.199); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
Stacktrace:
0   chromedriver                        0x0000000105a11d28 chromedriver + 4795688
1   chromedriver                        0x0000000105a092b3 chromedriver + 4760243
2   chromedriver                        0x00000001055e288d chromedriver + 407693
3   chromedriver                        0x00000001056313d9 chromedriver + 730073
4   chromedriver                        0x0000000105631591 chromedriver + 730513
5   chromedriver                        0x00000001056777e4 chromedriver + 1017828
6   chromedriver                        0x0000000105658ccd chromedriver + 892109
7   chromedriver                        0x0000000105674b2b chromedriver + 1006379
8   chromedriver                        0x0000000105658a73 chromedriver + 891507
9   chromedriver                        0x0000000105623143 chromedriver + 672067
10  chromedriver                        0x000000010562431e chromedriver + 676638
11  chromedriver                        0x00000001059d2795 chromedriver + 4536213
12  chromedriver                        0x00000001059d7853 chromedriver + 4556883
13  chromedriver                        0x00000001059b8001 chromedriver + 4427777
14  chromedriver                        0x00000001059d859d chromedriver + 4560285
15  chromedriver                        0x00000001059a948c chromedriver + 4367500
16  chromedriver                        0x00000001059f80e8 chromedriver + 4690152
17  chromedriver                        0x00000001059f829e chromedriver + 4690590
18  chromedriver                        0x0000000105a08eee chromedriver + 4759278
19  libsystem_pthread.dylib             0x00007ff813cce1d3 _pthread_start + 125
20  libsystem_pthread.dylib             0x00007ff813cc9bd3 thread_start + 15

[*] => Total time taken: 25.2536 seconds
(ig) ➜  insta-likecom-bot git:(master) ✗