Here's the problem with my my app - it seems that instapy is not able to locate input boxes due to "Allow cookies" mirror. I'm new to python, so please be understanding. What could be the possible solution?
InstaPy configurationInstaPy Version: 0.6.16.. .. .. .. .. .. .. .. ._.Workspace in use: "C:/Users/barto/InstaPy"OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOINFO [2023-04-02 01:41:20] [montyandmacythegoldens] Session started!ooooooooooooooooooooooooooooooooooooooooooooooooooooooINFO [2023-04-02 01:41:23] [montyandmacythegoldens] - Cookie file not found, creating cookie...WARNING [2023-04-02 01:41:33] [montyandmacythegoldens] Login A/B test detected! Trying another string...WARNING [2023-04-02 01:41:38] [montyandmacythegoldens] Could not pass the login A/B test. Trying last string...ERROR [2023-04-02 01:41:43] [montyandmacythegoldens] 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 "C:\Users\barto\InstagramBOT.venv\Lib\site-packages\instapy\login_util.py", line 337, in login_userlogin_elem = browser.find_element(^^^^^^^^^^^^^^^^^^^^^File "C:\Users\barto\InstagramBOT.venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 831, in find_elementreturn self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "C:\Users\barto\InstagramBOT.venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 440, in executeself.error_handler.check_response(response)File "C:\Users\barto\InstagramBOT.venv\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 245, in check_responseraise 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:8WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:180:5NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:392:5element.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 "C:\Users\barto\InstagramBOT.venv\Lib\site-packages\instapy\login_util.py", line 343, in login_userlogin_elem = browser.find_element(^^^^^^^^^^^^^^^^^^^^^File "C:\Users\barto\InstagramBOT.venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 831, in find_elementreturn self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "C:\Users\barto\InstagramBOT.venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 440, in executeself.error_handler.check_response(response)File "C:\Users\barto\InstagramBOT.venv\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 245, in check_responseraise 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:8WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:180:5NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:392:5element.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 "C:\Users\barto\InstagramBOT.venv\Lib\site-packages\instapy\login_util.py", line 350, in login_userlogin_elem = browser.find_element(^^^^^^^^^^^^^^^^^^^^^File "C:\Users\barto\InstagramBOT.venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 831, in find_elementreturn self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "C:\Users\barto\InstagramBOT.venv\Lib\site-packages\selenium\webdriver\remote\webdriver.py", line 440, in executeself.error_handler.check_response(response)File "C:\Users\barto\InstagramBOT.venv\Lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 245, in check_responseraise 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:8WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:180:5NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:392:5element.find/</<@chrome://remote/content/marionette/element.sys.mjs:134:16
....................................................................................................................................CRITICAL [2023-04-02 01:41:43] [montyandmacythegoldens] Unable to login to Instagram! You will find more information in the logs above.''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
INFO [2023-04-02 01:41:46] [montyandmacythegoldens] Sessional Live Report:|> No any statistics to show
[Session lasted 31.97 seconds]OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOINFO [2023-04-02 01:41:46] [montyandmacythegoldens] Session ended!ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
Code looks like this:
from credentials import login, password
from instapy import InstaPy
from instapy import smart_run
# login credentials
insta_username = login
insta_password = password
comments = ['Nice shot! @{}',
'I love your profile! @{}',
'Your feed is an inspiration :thumbsup:',
'Just incredible :open_mouth:',
'What camera did you use @{}?',
'Love your posts @{}',
'Looks awesome @{}',
'Getting inspired by you @{}',
':raised_hands: Yes!',
'I can feel your passion @{} :muscle:']
# get an InstaPy session!
# set headless_browser=True to run InstaPy in the background
session = InstaPy(username=insta_username,
password=insta_password,
headless_browser=False, want_check_browser=False)
with smart_run(session):
""" Activity flow """
# activity
session.like_by_tags(["natgeo"], amount=3)
I had some previous errors with checking browser, and locating geckodriver, but it seems I resolved that.