Hi everyone, I hope you guys are doing well :
( I got the last version of commits )
the code I am using:
session.login()
session.set_relationship_bounds(enabled=False,
potency_ratio=-1.21,
delimit_by_numbers=False,
max_followers=4590,
max_following=5555,
min_followers=45,
min_following=77)
session.set_simulation(enabled=False)
session.set_skip_users(skip_private=True,
private_percentage=100,
skip_no_profile_pic=False,
no_profile_pic_percentage=100,
skip_business=False,
business_percentage=100,
skip_business_categories=[],
dont_skip_business_categories=[])
session.set_user_interact(amount=2, randomize=True, percentage=100, media='Photo')
session.set_do_like(enabled=True, percentage=100)
session.interact_user_followers(['user'], amount=1600, randomize=False)
the error I got
Traceback (most recent call last):
File "like.py", line 57, in <module>
session.interact_user_followers(['username'], amount=1600, randomize=False)
File "/Users/user/Desktop/instagram/InstaPy/instapy/instapy.py", line 2801, in interact_user_followers
self.logfolder)
File "/Users/user/Desktop/instagram/InstaPy/instapy/unfollow_util.py", line 1082, in get_given_user_followers
logger, logfolder)
File "/Users/user/Desktop/instagram/InstaPy/instapy/unfollow_util.py", line 810, in get_users_through_dialog
dialog = browser.find_element_by_xpath(dialog_address)
File "/usr/local/lib/python2.7/site-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/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 978, in find_element
'value': value})['value']
File "/usr/local/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/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":"//body/div[2]/div/div[2]"}
Thank you for helping !
same. might be the HTML changed
I have the same error, I went back to following by tags. I'm presuming the element has changed location on the website.
Got the same error interacting whit the followers of my competitors, theres any solution?
Same issue here.
The dialog_address
xpath in the unfollow_util.py
needs to be changed. The followers dialog box opens successfully but it gets closed when it tries to scroll
Don't have time to look into it right now, but hope that's a starting point someone can build off of!
File: unfollow_util.py
Solution:
# find dialog box
dialog_address = "//body/div[3]/div/div[2]"
dialog = browser.find_element_by_xpath(dialog_address)
Before:
# find dialog box
dialog_address = "//body/div[2]/div/div[2]"
dialog = browser.find_element_by_xpath(dialog_address)
Thanks @globsecure!!
@globsecure thanks a lot works perfect for me !
@globsecure works here, thanks!
File: unfollow_util.py
Solution:find dialog box
dialog_address = "//body/div[3]/div/div[2]"
dialog = browser.find_element_by_xpath(dialog_address)Before:
find dialog box
dialog_address = "//body/div[2]/div/div[2]"
dialog = browser.find_element_by_xpath(dialog_address)
Thanks @globsecure, worked perfectly!
the solution is working, thank you @globsecure, I am closing this thread
Thanks @globsecure for the solution, appreciate it!
Quick question however:
If I install instapy on a server via pip and then import the library in a Python script, it will still produce this error, right?
I changed it, but now I got this error :
Cookie file not found, creating cookie...
web_1 | Traceback (most recent call last):
web_1 | File "code/docker_quickstart.py", line 14, in
web_1 | session.login()
web_1 | File "/code/instapy/instapy.py", line 360, in login
web_1 | self.bypass_with_mobile):
web_1 | File "/code/instapy/login_util.py", line 262, in login_user
web_1 | "//button[text()='Log in']")
web_1 | File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 394, in find_element_by_xpath
web_1 | return self.find_element(by=By.XPATH, value=xpath)
web_1 | File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 978, in find_element
web_1 | 'value': value})['value']
web_1 | File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
web_1 | self.error_handler.check_response(response)
web_1 | File "/usr/local/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
web_1 | raise exception_class(message, screen, stacktrace)
web_1 | selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//button[text()='Log in']"}
web_1 | (Session info: chrome=72.0.3626.81)
web_1 | (Driver info: chromedriver=2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926),platform=Linux 4.9.13-moby x86_64)
web_1 |
instapymaster2_web_1 exited with code 1
I guess an error is still on the file "Log in"
Thanks @globsecure for the solution, appreciate it!
Quick question however:
If I install instapy on a server via pip and then import the library in a Python script, it will still produce this error, right?
Yeah...
Using: pip install -e . (Compile local)
BUT:
pip install instapy -U (solution on production)
@globsecure amazing.. thank you.
@globsecure Awesome! Thank you! May one day I understand this stuff as you guys do. :)
Now the issue is change to //body/div[3]/div/div[2] also failed.
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate eleme
t: {"method":"xpath","selector":"//body/div[3]/div/div[2]"}
(Session info: chrome=73.0.3683.86)
(Driver info: chromedriver=2.44.609538 (b655c5a60b0b544917107a59d4153d4bf78e1b90),platform=Window
NT 6.1.7601 SP1 x86_64)
I'm new to all this, how do I use the solution given?
@jointyje which OS did you use ?
For any of you having this issue on Mac.
I got it fixed by updating the app with update.command
@CamiloB i am using windows 8
@CamiloB i am using windows 8
I believe the file to update on Windows is installations/Windows/update.bat
Give it a try.
I'm still getting this error "method":"xpath","selector":"//body/div[3]/div/div[2]"
I already used the update command on macOS
Message: no such element: Unable to locate element: {"method":"xpath","selector":"//body/div[3]/div/div[2]"}
Message: _no such element: Unable to locate element:_
The error is right there. You might have the wrong xpath from the page you are working on. Try getting it again.
i try to change :
https://github.com/timgrossmann/InstaPy/blob/master/instapy/unfollow_util.py#L809
Old
dialog_address = "//body/div[3]/div/div[2]"
New
dialog_address = "//body/div[@ROLEhttps://github.com/ROLE="presentation"]/div/div[2]"
But same error
De : alexguz79 notifications@github.com
Envoyé : vendredi 3 mai 2019 21:15
À : timgrossmann/InstaPy
Cc : GeoffreyPG; Comment
Objet : Re: [timgrossmann/InstaPy] Selenium Unable to locate element (#4240)
Message: no such element: Unable to locate element:
The error is right there. You might have the wrong xpath from the page you are working on. Try getting it again.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHubhttps://github.com/timgrossmann/InstaPy/issues/4240#issuecomment-489209226, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALUNO3IM66PU5NMYCDZSQV3PTSFNNANCNFSM4HC3I2NA.
I got the same error as the original post "Unable to locate element: {"method":"xpath","selector":"//body/div[2]/div/div[2]".
Changed it to the solution proposed by @globsecure, but now I'm just getting "Unable to locate element: {"method":"xpath","selector":"//body/div[2]/div/div[2]" instead.
I'm guessing Instagram has changed the UI again?
Running the latest build (0.4.2) with chromedriver 2.36.post0
Most helpful comment
File: unfollow_util.py
Solution:
Before: