0

I executed this code for a testing robot and I got this error and I don't know what i have to do?

from instapy import InstaPy

session = InstaPy(username="<your_username>", password="<your_password>")
session.login()
session.like_by_tags(["bmw", "mercedes"], amount=5)
session.set_dont_like(["naked", "nsfw"])
session.set_do_follow(True, percentage=50)
session.set_do_comment(True, percentage=50)
session.set_comments(["Nice!", "Sweet!", "Beautiful :heart_eyes:"])
session.end()

Error:

File "c:/Users/omid/Desktop/New folder/instaPy.py", line 4, in <module>
    session.login()
  File "C:\Users\omid\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\instapy\instapy.py", line 366, in login
    if not login_user(self.browser,
  File "C:\Users\omid\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\instapy\login_util.py", line 203, in login_user
    login_elem = browser.find_element_by_xpath(
  File "C:\Users\omid\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\remote\webdriver.py", line 394, in find_element_by_xpath
    return self.find_element(by=By.XPATH, value=xpath)
  File "C:\Users\omid\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\remote\webdriver.py", line 976, in find_element
    return self.execute(Command.FIND_ELEMENT, {
  File "C:\Users\omid\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\omid\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in 
check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//article//a[text()='Log in']"}
  (Session info: chrome=87.0.4280.66)
  (Driver info: chromedriver=2.44.609538 (b655c5a60b0b544917107a59d4153d4bf78e1b90),platform=Windows NT 10.0.18363 x86_64)
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352

1 Answers1

0

Your main issue is the incompatibility between the version of the binaries you are using as follows:

  • You are using chromedriver=2.44
  • Release Notes of chromedriver=2.44 clearly mentions the following :

Supports Chrome v69-71

  • You are using chrome=87.0.4280.66
  • Release Notes of ChromeDriver v87.0 clearly mentions the following :

Supports Chrome version 87

So there is a clear mismatch between ChromeDriver v2.44 and the Chrome Browser v85.0


Solution

Ensure that:

  • Selenium is upgraded to current released Version 3.141.59.
  • ChromeDriver is updated to current ChromeDriver v87.0 level.
  • Chrome is updated to current Chrome Version 87.0 level. (as per ChromeDriver v87.0 release notes).
  • If your base Web Client version is too old, then uninstall it and install a recent GA and released version of Web Client.
  • Take a System Reboot.
  • Execute your @Test as non-root user.
  • Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
undetected Selenium
  • 183,867
  • 41
  • 278
  • 352