Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Login A/B test detected! Trying another string... #6766

Open
MlcodeDev opened this issue Oct 10, 2023 · 2 comments
Open

Login A/B test detected! Trying another string... #6766

MlcodeDev opened this issue Oct 10, 2023 · 2 comments

Comments

@MlcodeDev
Copy link

I know that this topic was discussed many times, but nothing works for me.

Description

So, I have this simple code, to test if everything works:

from instapy import InstaPy
from lib.userdata import user, passwd

session = InstaPy(username=user,
                  password=passwd,
                  headless_browser=False,
                  want_check_browser=False)


session.login()
session.like_by_tags(["asus", "samsung"], amount=5)
session.end()

In the console I get:

Workspace in use: "/home/mlc/InstaPy"
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO [2023-10-10 14:27:39] [mlctest123]  Session started!
oooooooooooooooooooooooooooooooooooooooooooooooooooooo
INFO [2023-10-10 14:27:46] [mlctest123]  - Cookie file not found, creating cookie...
WARNING [2023-10-10 14:27:56] [mlctest123]  Login A/B test detected! Trying another string...
WARNING [2023-10-10 14:28:01] [mlctest123]  Could not pass the login A/B test. Trying last string...
ERROR [2023-10-10 14:28:06] [mlctest123]  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:189:5\nNoSuchElementError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:507:5\ndom.find/</<@chrome://remote/content/shared/DOM.sys.mjs:132:16\n"
Traceback (most recent call last):
  File "/home/mlc/.local/lib/python3.11/site-packages/instapy/login_util.py", line 337, in login_user
    login_elem = browser.find_element(
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/home/mlc/.local/lib/python3.11/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/mlc/.local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute
    self.error_handler.check_response(response)
  File "/home/mlc/.local/lib/python3.11/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:189:5
NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:507:5
dom.find/</<@chrome://remote/content/shared/DOM.sys.mjs:132:16


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mlc/.local/lib/python3.11/site-packages/instapy/login_util.py", line 343, in login_user
    login_elem = browser.find_element(
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/home/mlc/.local/lib/python3.11/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/mlc/.local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute
    self.error_handler.check_response(response)
  File "/home/mlc/.local/lib/python3.11/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:189:5
NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:507:5
dom.find/</<@chrome://remote/content/shared/DOM.sys.mjs:132:16


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mlc/.local/lib/python3.11/site-packages/instapy/login_util.py", line 350, in login_user
    login_elem = browser.find_element(
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/home/mlc/.local/lib/python3.11/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/mlc/.local/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 440, in execute
    self.error_handler.check_response(response)
  File "/home/mlc/.local/lib/python3.11/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:189:5
NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:507:5
dom.find/</<@chrome://remote/content/shared/DOM.sys.mjs:132:16

........................................................................................................................
CRITICAL [2023-10-10 14:28:06] [mlctest123]  Unable to login to Instagram! You will find more information in the logs above.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

INFO [2023-10-10 14:28:10] [mlctest123]  Sessional Live Report:
	|> No any statistics to show


[Session lasted 44.05 seconds]
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
INFO [2023-10-10 14:28:10] [mlctest123]  Session ended!
ooooooooooooooooooooooooooooooooooooooooooooooooooooooo

Problem

So First, I encountered a cookie's file problem, like it didn't want to click the accept cookies button, but I gave up on this
Then I encountered another problem, this time with the A/B test problem.

WARNING [2023-10-10 14:27:56] [mlctest123]  Login A/B test detected! Trying another string...
WARNING [2023-10-10 14:28:01] [mlctest123]  Could not pass the login A/B test. Trying last string...

What I tried

To fix the cookies problem I tried this solution, but I didn't fix the problem.
#5815 (comment)

To fix the A/B test problem, I tried this:
https://stackoverflow.com/questions/68623885/instapy-doesnt-login-into-account
#4895 (comment)

but nothing worked for me, could someone help?

@skinnyshiro
Copy link

Hey,
I encountered the same thing. I was reading #4877 where @Mr-HaleYa resolved the issue.

However, what he suggested no longer works on the current Instagram login page. What the code is doing is looking for HTML that contains the the text either "Log In" or "Log in".

In xpath_compile.py, you will need to update one of the lines to: "login_elem_no_such_exception": "//div[text()='Log in']",

The important part is that you use //div and 'Log in'. However, if that stops working in the future, do inspect element on Instagram's login page to see what their new HTML code is. Details on how to actually find the xpath_compile.py file can be found on the thread I linked.

image

@Cinkieee
Copy link

Cinkieee commented Jan 3, 2024

login_elem_no_such_exception": "//div[text()='Log in']"

I am getting another issue after updating xpath_compile.py

WARNING [2024-01-03 09:09:49] [x] Login A/B test detected! Trying another string...
INFO [2024-01-03 09:10:28] [x] Timed out with failure while explicitly waiting until visibility of element located!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants