Instapy: Comment Button Not Found!

Created on 18 Jan 2020  Â·  9Comments  Â·  Source: timgrossmann/InstaPy


Expected Behavior

comment on the post

Current Behavior

Comment Button Not Found! ~may cause issues with browser windows of smaller widths

Possible Solution (optional)

maybe instagram has changed it's Xpath

InstaPy configuration

`with smart_run(session):
# general settings

session.set_relationship_bounds(enabled=True,
             potency_ratio=None,
              delimit_by_numbers=True,
               max_followers=2000000,
                max_following=10000,
                 min_followers=10,
                  min_following=10)
session.set_user_interact(amount=2, randomize=True, percentage=100,
media='Photo')
session.set_do_follow(enabled=True, percentage=100)
time.sleep(30)
session.set_do_like(enabled=True, percentage=100)
session.set_comments(["Your work is rockin @{}", "Well done @{} :muscle:", "Your posts are excellent :thumbsup: ", "What a really nice photo, great job! @{}"])
session.set_do_comment(enabled=True, percentage=100)
session.set_user_interact(amount=2, randomize=True, percentage=100,
media='Photo')

# activity

session.interact_user_followers(['pewdiepie'],
amount=10, randomize=True)
session.follow_user_followers(['pewdiepie'],
amount=10, randomize=True, interact=True)
session.unfollow_users(amount=100, nonFollowers=True, style="RANDOM",
unfollow_after=42*60*60, sleep_delay=30)
session.like_by_tags(['fashion', 'style', 'consciousfashion', 'fashioneveryday', 'lookoftheday', 'womensfashionfinds', 'fashiontech', 'whatiwore'], amount=10)
time.sleep(20)

`

wontfix

Most helpful comment

IG changed HTML code
In the file xpath_compile.py change:
xpath["open_comment_section"] = {"comment_elem": "//button[*[local-name()='svg']/@aria-label='Comment']"}
OLD - "//button/span[@aria-label='Comment']"
and also
xpath["get_comment_input"] = { "comment_input": "//form/textarea", "placeholder": '//textarea[@placeholder = "Add a comment…"]', }
OLD - "placeholder": '//input[@Placeholder = "Add a comment…"]',
There is a lot of changes in HTML elements. Need to check all elements

what changes did you made? can you paste here the new changes you made? thank you.
im also having problem with the part where the code checks if instagram is down. it keep telling me is down or something like that. can i stop it from checking that?

xpath for "Comment" element is changed

I replaced values "//button/span[@aria-label='Comment']" with "//button[*[local-name()='svg']/@aria-label='Comment']" for key "comment_elem"

also need to be replaced value '//input[@placeholder = "Add a comment…"]' with '//textarea[@placeholder = "Add a comment…"]' for key "placeholder"

All 9 comments

IG changed HTML code

In the file xpath_compile.py change:

xpath["open_comment_section"] = {"comment_elem": "//button[*[local-name()='svg']/@aria-label='Comment']"}
OLD - "//button/span[@aria-label='Comment']"

and also

xpath["get_comment_input"] = { "comment_input": "//form/textarea", "placeholder": '//textarea[@placeholder = "Add a comment…"]', }
OLD - "placeholder": '//input[@placeholder = "Add a comment…"]',

There is a lot of changes in HTML elements. Need to check all elements

IG changed HTML code

In the file xpath_compile.py change:

xpath["open_comment_section"] = {"comment_elem": "//button[*[local-name()='svg']/@aria-label='Comment']"}
OLD - "//button/span[@aria-label='Comment']"

and also

xpath["get_comment_input"] = { "comment_input": "//form/textarea", "placeholder": '//textarea[@placeholder = "Add a comment…"]', }
OLD - "placeholder": '//input[@Placeholder = "Add a comment…"]',

There is a lot of changes in HTML elements. Need to check all elements

what changes did you made? can you paste here the new changes you made? thank you.
im also having problem with the part where the code checks if instagram is down. it keep telling me is down or something like that. can i stop it from checking that?

IG changed HTML code
In the file xpath_compile.py change:
xpath["open_comment_section"] = {"comment_elem": "//button[*[local-name()='svg']/@aria-label='Comment']"}
OLD - "//button/span[@aria-label='Comment']"
and also
xpath["get_comment_input"] = { "comment_input": "//form/textarea", "placeholder": '//textarea[@placeholder = "Add a comment…"]', }
OLD - "placeholder": '//input[@Placeholder = "Add a comment…"]',
There is a lot of changes in HTML elements. Need to check all elements

what changes did you made? can you paste here the new changes you made? thank you.
im also having problem with the part where the code checks if instagram is down. it keep telling me is down or something like that. can i stop it from checking that?

yes the site "isitdownorjust.me" is down for some reason

IG changed HTML code
In the file xpath_compile.py change:
xpath["open_comment_section"] = {"comment_elem": "//button[*[local-name()='svg']/@aria-label='Comment']"}
OLD - "//button/span[@aria-label='Comment']"
and also
xpath["get_comment_input"] = { "comment_input": "//form/textarea", "placeholder": '//textarea[@placeholder = "Add a comment…"]', }
OLD - "placeholder": '//input[@Placeholder = "Add a comment…"]',
There is a lot of changes in HTML elements. Need to check all elements

what changes did you made? can you paste here the new changes you made? thank you.
im also having problem with the part where the code checks if instagram is down. it keep telling me is down or something like that. can i stop it from checking that?

xpath for "Comment" element is changed

I replaced values "//button/span[@aria-label='Comment']" with "//button[*[local-name()='svg']/@aria-label='Comment']" for key "comment_elem"

also need to be replaced value '//input[@placeholder = "Add a comment…"]' with '//textarea[@placeholder = "Add a comment…"]' for key "placeholder"

@zipsoft can you submit a pull request?

I believe this would be very welcome :)

Created #5296

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

IG changed HTML code
In the file xpath_compile.py change:
xpath["open_comment_section"] = {"comment_elem": "//button[*[local-name()='svg']/@aria-label='Comment']"}
OLD - "//button/span[@aria-label='Comment']"
and also
xpath["get_comment_input"] = { "comment_input": "//form/textarea", "placeholder": '//textarea[@placeholder = "Add a comment…"]', }
OLD - "placeholder": '//input[@Placeholder = "Add a comment…"]',
There is a lot of changes in HTML elements. Need to check all elements

what changes did you made? can you paste here the new changes you made? thank you.
im also having problem with the part where the code checks if instagram is down. it keep telling me is down or something like that. can i stop it from checking that?

put want_check_browser=False in session

xpath should be:
xpath["open_comment_section"] = { "comment_elem": "//button/div[*[local-name()='svg']/@aria-label='Comment']" }

Was this page helpful?
0 / 5 - 0 ratings

Related issues

v77v picture v77v  Â·  3Comments

ediooo picture ediooo  Â·  3Comments

CodeMaster1 picture CodeMaster1  Â·  3Comments

Naramsim picture Naramsim  Â·  3Comments

neomh picture neomh  Â·  3Comments