InstaPy icon indicating copy to clipboard operation
InstaPy copied to clipboard

[FIX]IG Change Login Class Element - Cannot Creating Cookies or New Login Issue When Deleting Cookies

Open solehpolysas opened this issue 8 years ago • 20 comments

Expected Behavior

Should be working & creating new cookies for new account in the System.

Current Behavior

Error when creating cookies. Stuck at login page, not login anymore. Traceback (most recent call last): File "quickstart.py", line 20, in <module> session.login() File "C:\Users\admin\Desktop\Tools\Backup InstaPy\InstaPy-master\instapy\instapy.py", line 322, in login self.bypass_suspicious_attempt): File "C:\Users\admin\Desktop\Tools\Backup InstaPy\InstaPy-master\instapy\login_util.py", line 136, in login_user "//select[@class='_fsoey']/option[text()='English']").click() File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 385, in find_element_by_xpath return self.find_element(by=By.XPATH, value=xpath) File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 955, in find_element 'value': value})['value'] File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 312, in execute self.error_handler.check_response(response) File "C:\Users\admin\AppData\Local\Programs\Python\Python36\lib\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":"//select[@class='_fsoey']/option[text()='English']"} (Session info: chrome=66.0.3359.181) (Driver info: chromedriver=2.39.562718 (9a2698cba08cf5a471a29d30c8b3e12becabb0e9),platform=Windows NT 10.0.16299 x86_64)

InstaPy configuration

Basic quickstart, just need to creating cookies, but FAIL.

20180531-132628.zip

Anyone facing the same issue? If you already have cookies, i dont think you will get this error.

But if you change or delete cookies or use new account, this error will come. Someone please verify this.

Thanks in advance.

solehpolysas avatar May 31 '18 05:05 solehpolysas

It seems they updated their styles which changed the select element class name from _fsoey to hztqj. This edit belongs in the login_util.py.

This is definitely not isolated incident though, and other classes that InstaPy depends on were changed too.

mrboomer avatar May 31 '18 07:05 mrboomer

So this change effect system to working well. But weird other function like by tag, follow user follower still working fine at my side.

Im change a little bit code in login_util.py to bypass login page. Right now i can login back & creating new cookies.

maybe this will need to change all old class element to new one. Hope some one will make new PR about this ASAP.

solehpolysas avatar May 31 '18 07:05 solehpolysas

@solehpolysas I have the same problem. what code did you change in login_util.py?

davidegalizzi87 avatar May 31 '18 08:05 davidegalizzi87

Please read New update : https://github.com/timgrossmann/InstaPy/issues/2133#issuecomment-394098747

solehpolysas avatar May 31 '18 09:05 solehpolysas

@solehpolysas for me don't work

davidegalizzi87 avatar May 31 '18 13:05 davidegalizzi87

@solehpolysas Thanks for the code it works but I have another issue. When the bot joins the instagram and types my id pass firstly it says wrong id pass then somehow it enters the instagram but unfortunately the browser suddenly closes. How can we fix it?

gumusonur avatar May 31 '18 15:05 gumusonur

@Gallo87 Can you share your log or error that display when running that?

@Veinex Please make sure you have key in the correct information 'username & password' double check that.

If it successfully log in, then 'login_util.py' working. So you need to share what error that you facing after that.

solehpolysas avatar May 31 '18 15:05 solehpolysas

@solehpolysas my problem is this now: `INFO [2018-05-31 17:44:32] [wakeup.and.win] Session started - 2018-05-31 17:44:32 INFO [2018-05-31 17:45:01] [wakeup.and.win] Logged in successfully! INFO [2018-05-31 17:45:03] [wakeup.and.win] Session ended - 2018-05-31 17:45:03 INFO [2018-05-31 17:45:03] [wakeup.and.win] --------------------

Traceback (most recent call last): File "_wakeup_new.py", line 28, in session.set_upper_follower_count(limit=2000) AttributeError: InstaPy instance has no attribute 'set_upper_follower_count'`

but if I hide # session.set_upper_follower_count(limit=2000) Logged in successfully!

but then

Traceback (most recent call last): File "_wakeup_new.py", line 32, in <module> session.set_dont_unfollow_active_users(enabled=True, posts=5) File "/Users/davide/instapy/instapy/instapy.py", line 2357, in set_dont_unfollow_active_users self.logger) File "/Users/davide/instapy/instapy/util.py", line 202, in get_active_users "//span[contains(@class,'_t98z6')]//span").text) File "/Library/Python/2.7/site-packages/selenium-2.53.6-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 293, in find_element_by_xpath return self.find_element(by=By.XPATH, value=xpath) File "/Library/Python/2.7/site-packages/selenium-2.53.6-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 752, in find_element 'value': value})['value'] File "/Library/Python/2.7/site-packages/selenium-2.53.6-py2.7.egg/selenium/webdriver/remote/webdriver.py", line 236, in execute self.error_handler.check_response(response) File "/Library/Python/2.7/site-packages/selenium-2.53.6-py2.7.egg/selenium/webdriver/remote/errorhandler.py", line 192, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//span[contains(@class,'_t98z6')]//span"} (Session info: chrome=66.0.3359.181) (Driver info: chromedriver=2.39.562713 (dd642283e958a93ebf6891600db055f1f1b4f3b2),platform=Mac OS X 10.13.4 x86_64)

davidegalizzi87 avatar May 31 '18 15:05 davidegalizzi87

@solehpolysas , your update to login util file works, make a push requests so this error is updated ASAP, otherwise I can imagine noone can log in.

david-vendel avatar May 31 '18 16:05 david-vendel

@solehpolysas I managed to solve it with my other computer, again thanks for your code.

gumusonur avatar May 31 '18 16:05 gumusonur

Is there a PR opened for this?

bvanhou avatar May 31 '18 19:05 bvanhou

Just like @mrboomer suggest, yes new class element fix login. Thank to @bvanhou for open PR #2137

@Gallo87 please check new open PR for this creating cookies also check PR about #2136

Hope all this fix will merge soon after check & verified. Im closing this & feel free to open if having any further issue related.

solehpolysas avatar Jun 01 '18 01:06 solehpolysas

I did the suggested above and it can loggin now, but then instead of give likes it is following:

It seems they updated their styles which changed the select element class name from _fsoey to hztqj. This edit belongs in the login_util.py.

INFO [2018-05-31 17:45:01] [xxx]  Logged in successfully!
INFO [2018-05-31 17:45:03] [xxx]  User 'xxxx' [1/1]
INFO [2018-05-31 17:45:19] [xxx]  Simulated follow : 1
INFO [2018-05-31 17:45:21] [xxx]  --> Followed yyyyyy

It did follow 3 or 4 users when it was supposed to do likes.

INFO [2018-05-31 15:22:47] [xxx]  Logged in successfully!
INFO [2018-05-31 15:22:49] [xxx]  User 'pitty' [1/1]
INFO [2018-05-31 15:23:51] [xxx]  Simulated follow : 1
INFO [2018-05-31 15:23:55] [xxx]  --> Followed yyy1
INFO [2018-05-31 15:24:43] [xxx]  Simulated follow : 2
INFO [2018-05-31 15:24:45] [xxx]  --> Followed fff2
INFO [2018-05-31 15:25:27] [xxx]  Simulated follow : 3
INFO [2018-05-31 15:25:30] [xxx]  --> Followed ttt3
INFO [2018-05-31 15:26:14] [xxx]  Simulated follow : 4
INFO [2018-05-31 15:26:17] [xxx]  --> Followed vvv4
INFO [2018-05-31 15:26:57] [xxx]  Simulated follow : 5
INFO [2018-05-31 15:27:00] [xxx]  --> Followed hhh5
INFO [2018-05-31 15:27:47] [xxx]  Simulated follow : 6
INFO [2018-05-31 15:27:50] [xxx]  --> Followed bbb6

It should do instead:


INFO [2018-03-29 02:16:30] [xxx]  Username [329/330]
INFO [2018-03-29 02:16:30] [xxx]  --> xxxxxx
INFO [2018-03-29 02:16:34] [xxx]  Getting xxxxxx image list...
INFO [2018-03-29 02:17:02] [xxx]  Interaction begin...
INFO [2018-03-29 02:17:33] [xxx]  --> Not following
INFO [2018-03-29 02:17:34] [xxx]  Post [1/2]
INFO [2018-03-29 02:17:34] [xxx]  _link_
INFO [2018-03-29 02:17:38] [xxx]  Image from: xxxxxx
INFO [2018-03-29 02:17:45] [xxx]  Number of Followers: 150
INFO [2018-03-29 02:17:45] [xxx]  Link: _link_
INFO [2018-03-29 02:17:45] [xxx]  Description: gggggg
INFO [2018-03-29 02:17:48] [xxx]  --> Image Liked!

uki-uki avatar Jun 01 '18 01:06 uki-uki

@mrboomer Tanks buddy !! works for me !!!

mrrobotsca avatar Jun 01 '18 04:06 mrrobotsca

After downloading the latest version, I was having problem with the cookie creation. login_util.zip worked for me.

succulentia avatar Jun 01 '18 15:06 succulentia

Doesn't working here. It just fill up the password -- with nothing in the username, it can't log in. Already checked and the informations are correct!

claraabelha avatar Jun 02 '18 13:06 claraabelha

A few user seems like not get it working properly. After a few check at my side, YES it's not work. It too quick for any reason i don't know why.

So i just make a little FIX here, new input sleep(1) add at new line 147. or feel free to download my file here. login_util.zip

Please remember, this just FIX for login or creating cookies issue. For other issue, please refer OPEN PR or Other Open Issue.

I open this back for any discussion & if new PR already merged, please close this issue. :)

solehpolysas avatar Jun 02 '18 16:06 solehpolysas

@solehpolysas I have this same error. I have sleep(1) at line 147, but it still says wrong login data. How can I fix this problem?

aku6640 avatar Jun 14 '18 02:06 aku6640

@aku6640

  1. Get latest Master File

  2. Edit just like i comments above.

  3. Optional : set sleep(5)

Try your best. Maybe this error caused by slow internet connection 🤔 i dont know.

So let see what your chrome browser do. Its too fast or it skip login page?

Test at your local machine first.

solehpolysas avatar Jun 14 '18 02:06 solehpolysas

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this problem still occurs, please open a new issue

stale[bot] avatar Nov 14 '18 08:11 stale[bot]