Problem with XPath
Expected Behavior
to login successfully
Current Behavior
Traceback (most recent call last):
File "quickstart.py", line 27, in
Possible Solution (optional)
InstaPy configuration
settings import os import time from tempfile import gettempdir
from selenium.common.exceptions import NoSuchElementException
from instapy import InstaPy
insta_username = '' insta_password = ''
set headless_browser=True if you want to run InstaPy on a server
set these in instapy/settings.py if you're locating the ibrary in the /usr/lib/pythonX.X/ directory: Settings.database_location = '/path/to/instapy.db' Settings.chromedriver_location = '/path/to/chromedriver'
session = InstaPy(username=insta_username, password=insta_password, headless_browser=True, multi_logs=True)
try: session.login()
session.set_relationship_bounds(enabled=False,
potency_ratio=-1.21,
delimit_by_numbers=True,
max_followers=4590,
max_following=5555,
min_followers=45,
min_following=77)
session.set_blacklist(enabled=True, campaign='camp1')
session.set_dont_like(['beauty', 'forex', 'shop', 'store'])
session.set_ignore_if_contains(['follow', 'follower', 'gain', '.id', '_id', 'forex', 'binary', 'meme', 'promotion'])
session.set_do_follow(enabled=True, percentage=100, times=1)
session.set_do_comment(enabled=True, percentage=100)
session.set_comments(['amazing', 'nice'])
for cycle in range(99999):
print("\n\nLOOP {}\n".format(cycle+1))
session.like_by_tags(['natgeo', 'adventure'], amount=1)
except Exception as exc: if changes to IG layout, upload the file to help us locate the change if isinstance(exc, NoSuchElementException): file_path = os.path.join(gettempdir(), '{}.html'.format(time.strftime('%Y%m%d-%H%M%s',))) with open(file_path, 'wb') as fp: fp.write(session.browser.page_source.encode('utf8')) print('{0}\nIf raising an issue, please also upload the file located at:\n{1}\n{0}'.format( '*' * 70, file_path)) full stacktrace when raising Github issue raise
finally: end the bot session session.end()
and please @timgrossmann get back the old version of instapy. it was easier. now it just became harder
hi
you can change login_util.py
login_button = browser.find_element_by_xpath(
"//button[text()='Log in']")
to
login_button = browser.find_element_by_xpath(
"//button//div[text()='Log in']")
You can join Discord for more communication.
If You want find me name BongGun
Fix PR is waiting for merge https://github.com/timgrossmann/InstaPy/pull/4035
@seominbong I don't know if you're god send but OMG it worked thank you so much! I wanna hug you!!!!!!!
@charlesccc the way @seominbong did it worked. Thank you so much
I try to change : Edit unfollow_util.py (line 809) 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[@ROLE="presentation"]/div/div[2]"
But same error
I'm getting a similar error:
Cookie file not found, creating cookie... Login A/B test detected! Trying another string...
The login_button no longer exists in login_util.py and has been replaced with
login_elem = browser.find_element_by_xpath(
read_xpath(login_user.__name__, "login_elem")
)
Any help here?