0

I'm trying to create a script in Instapy (Ubuntu), but it's giving a series of errors, and I'm not able to solve it, I've done some research, but nothing has worked yet.

He launches the browser and is stuck on this page until it closes. Print here

Does anyone know what can it be?

Apparently it has some bug with cookies, but I'm not sure if that's it.

** I'm still a beginner in python, so I still can't understand if it's something simple.*

Thanks All!!

this is my script:

from instapy import InstaPy
from instapy import smart_run


session = InstaPy(username="lojatocadosmagos", password="Esperteza@9396.", headless_browser=False, want_check_browser=False)

with smart_run(session):
    session.set_do_follow(enabled =True, percentage =10)
    session.set_do_like(enabled =True, percentage=10)

    session.like_by_tags(['magico'], amount=10)

    comentarios = [
    'Muito Bom!',
    'Gostei!',
    'Dahora',
    'Legal',
    'Muito Interessante',
    'Gostei Muito',
    'Boa',
    'Bom demais',
    'Ficou bom',
    'Bom post'
    ]
    
    session.set_do_comment(enabled=True, percentage=15)
    session.set_comments(comentarios, media='Photo')
    session.join_pods()
    session.end()

These are the errors:

InstaPy Version: 0.6.16
 ._.  ._.  ._.  ._.  ._.  ._.  ._.  ._. 
Workspace in use: "/home/nathan/InstaPy"
^[[COOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO [2023-04-02 16:44:46] [lojatocadosmagos]  Session started!
oooooooooooooooooooooooooooooooooooooooooooooooooooooo
INFO [2023-04-02 16:44:51] [lojatocadosmagos]  - Cookie file not found, creating cookie...
WARNING [2023-04-02 16:45:01] [lojatocadosmagos]  Login A/B test detected! Trying another string...
WARNING [2023-04-02 16:45:06] [lojatocadosmagos]  Could not pass the login A/B test. Trying last string...
ERROR [2023-04-02 16:45:11] [lojatocadosmagos]  Login A/B test failed!

    b"Message: Unable to locate element: //div[text()='Log In']\nStacktrace:\nRemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8\nWebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:180:5\nNoSuchElementError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:392:5\nelement.find/</<@chrome://remote/content/marionette/element.sys.mjs:134:16\n"
Traceback (most recent call last):
  File "/home/nathan/MyCodes/TocadosMagos/lib/python3.10/site-packages/instapy/login_util.py", line 337, in login_user
    login_elem = browser.find_element(
  File "/home/nathan/MyCodes/TocadosMagos/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 831, in find_element
    return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
  File "/home/nathan/MyCodes/TocadosMagos/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute
    self.error_handler.check_response(response)
  File "/home/nathan/MyCodes/TocadosMagos/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 245, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //button[text()='Log In']
Stacktrace:
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:180:5
NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:392:5
element.find/</<@chrome://remote/content/marionette/element.sys.mjs:134:16


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/nathan/MyCodes/TocadosMagos/lib/python3.10/site-packages/instapy/login_util.py", line 343, in login_user
    login_elem = browser.find_element(
  File "/home/nathan/MyCodes/TocadosMagos/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 831, in find_element
    return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
  File "/home/nathan/MyCodes/TocadosMagos/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute
    self.error_handler.check_response(response)
  File "/home/nathan/MyCodes/TocadosMagos/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 245, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //a[text()='Log in']
Stacktrace:
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:180:5
NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:392:5
element.find/</<@chrome://remote/content/marionette/element.sys.mjs:134:16


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/nathan/MyCodes/TocadosMagos/lib/python3.10/site-packages/instapy/login_util.py", line 350, in login_user
    login_elem = browser.find_element(
  File "/home/nathan/MyCodes/TocadosMagos/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 831, in find_element
    return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
  File "/home/nathan/MyCodes/TocadosMagos/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute
    self.error_handler.check_response(response)
  File "/home/nathan/MyCodes/TocadosMagos/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 245, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //div[text()='Log In']
Stacktrace:
RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8
WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:180:5
NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:392:5
element.find/</<@chrome://remote/content/marionette/element.sys.mjs:134:16

..............................................................................................................................
CRITICAL [2023-04-02 16:45:11] [lojatocadosmagos]  Unable to login to Instagram! You will find more information in the logs above.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
ERROR [2023-04-02 16:45:11] [lojatocadosmagos]  You have too few comments, please set at least 10 distinct comments to avoid looking suspicious.

INFO [2023-04-02 16:45:13] [lojatocadosmagos]  Sessional Live Report:
    |> No any statistics to show


[Session lasted 35.0 seconds]
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO [2023-04-02 16:45:13] [lojatocadosmagos]  Session ended!
ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo



Unable to remove profile specific paths.
Traceback (most recent call last):
  File "/home/nathan/MyCodes/TocadosMagos/lib/python3.10/site-packages/selenium/webdriver/firefox/webdriver.py", line 215, in quit
    rmtree(self.profile.path)
  File "/usr/lib/python3.10/shutil.py", line 714, in rmtree
    onerror(os.lstat, path, sys.exc_info())
  File "/usr/lib/python3.10/shutil.py", line 712, in rmtree
    orig_st = os.lstat(path)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmprxq8e3pt'

INFO [2023-04-02 16:45:13] [lojatocadosmagos]  Sessional Live Report:
    |> No any statistics to show


[Session lasted 35.02 seconds]
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO [2023-04-02 16:45:13] [lojatocadosmagos]  Session ended!
NatCorsi
  • 11
  • 3
  • Looking at [InstaPy's issues](https://github.com/InstaPy/InstaPy/issues), you're not the only one having this issue. I'd guess the library is broken. – AKX Apr 02 '23 at 19:59

0 Answers0