InstaPy / instapy-quickstart

💨 Simply get InstaPy up and running in minutes.
GNU General Public License v3.0
766 stars 792 forks source link

Error "Cookie file not found, creating cookie..." #208

Open Xen-neX opened 3 years ago

Xen-neX commented 3 years ago

InstaPy Version: 0.6.12 .. .. .. .. .. .. .. .. Workspace in use: "/home/xxxxxxx/InstaPy" INFO [2020-12-18 15:46:19] [xxxxxxx] Session started! OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO oooooooooooooooooooooooooooooooooooooooooooooooooooooo INFO [2020-12-18 15:46:19] [xxxxxxx] -- Connection Checklist [1/2] (Internet Connection Status) INFO [2020-12-18 15:46:21] [xxxxxxx] - Internet Connection Status: ok INFO [2020-12-18 15:46:21] [xxxxxxx] - Current IP is "195.246.120.63" and it's from "Sweden/SE" INFO [2020-12-18 15:46:21] [xxxxxxx] -- Connection Checklist [2/2] (Hide Selenium Extension) INFO [2020-12-18 15:46:21] [xxxxxxx] - window.navigator.webdriver response: None INFO [2020-12-18 15:46:21] [xxxxxxx] - Hide Selenium Extension: ok Cookie file not found, creating cookie... INFO [2020-12-18 15:47:05] [xxxxxxx] Timed out with failure while explicitly waiting until visibility of element located!

Traceback (most recent call last): File "xxxxxxx/main.py", line 38, in InstaPy(username="xxxxxxx", password="xxxxxxx").login() File "/usr/local/lib/python3.8/dist-packages/instapy/instapy.py", line 425, in login if not login_user( File "/usr/local/lib/python3.8/dist-packages/instapy/login_util.py", line 316, in login_user input_username = browser.find_element_by_xpath(input_username_XP) File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 394, in find_element_by_xpath return self.find_element(by=By.XPATH, value=xpath) File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 976, in find_element return self.execute(Command.FIND_ELEMENT, { File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/usr/local/lib/python3.8/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //input[@name='username']

https://ibb.co/VMSKDNw

elulcao commented 3 years ago

Thanks for sharing, the pic is referring to a new feature (page) that IG is using to track some user activities. Last PR was intended to handle that new page, did you use the latest commit from git? It is 0.6.12 but with extra commits.

Xen-neX commented 3 years ago

Thanks for sharing, the pic is referring to a new feature (page) that IG is using to track some user activities. Last PR was intended to handle that new page, did you use the latest commit from git? It is 0.6.12 but with extra commits.

I work through a virtual environment in PyCharm, install also through PyCharm.

CoderGOG commented 3 years ago

Still having this problem. Simply due to a new cookie screen @elulcao referenced to. Any change this will be updated soon?

image
elulcao commented 3 years ago

@CoderGOG This is the new page that must be problem. In my region, is not deployed yet, so I introduced a possible fix in latest commit. Did you use the latest commit?

CoderGOG commented 3 years ago

Thanks for the answer. I updated the InstaPy python library (still doesn't work after), but that isn't sufficient I suppose?

elulcao commented 3 years ago

It seems that function accept_igcookie_dialogue(browser, logger) needs to be updated, or this xpath xpath["accept_igcookie_dialogue"] = {"accept_button": "//button[text()='Accept']"} need to be updated also. The main issue, then is just to automate the action for clicking the Accept button.

iampatrickbrinksma commented 3 years ago

@elulcao @CoderGOG what I did was in the function login_user (login_util.py) when cookies can't be loaded, the instagram homepage is loaded again, after which cookies need to be accepted. I added the line:

accept_igcookie_dialogue(browser, logger)

Then it works when logging in.

This is only necessary for the first login when there is no cookie yet.

elulcao commented 3 years ago

@ikbenpatrickbrinksma I guess you are correct. In the geographic zone Im living at, that page has not be released, so I cannot test in my local the function at al. I posted in other issues comments about the issue Im facing, also requested some help to verify the correct functionality; but not response for now. I you can propose a possible fix, please let us now.

iampatrickbrinksma commented 3 years ago

@elulcao I suggest to add the line as I suggested.

Add line:

accept_igcookie_dialogue(browser, logger)

after web_address_navigator(browser, ig_homepage) on line 317

diogoribeirodev commented 3 years ago

i keep getting the same error

alirezamdv commented 2 years ago

in xpath_compile.py edit last xpath to "Allow essential and optional cookies"