Comment on users photos.
Not crashing but getting warnings that the comment button is not found. And then giving another warning that comment has likely failed. (See Image Below)
Running the latest version of Instapy on a virtual machine Ubuntu Linux with AWS.
Have same issue: WARNING - --> Warning: Comment Action Likely Failed: Comment Element not found
I'm tried to add chrome_options.add_argument('--start-fullscreen') to main file, but it doesn't fix, instead have message: WARNING - --> Warning: Comment Button Not Found: May cause issues with browser windows of smaller widths
I have noticed this warning comes from login procedure failing at the beginning of the initialization process, when the script is initialized. I am having the same issues. Gonna look into the login.py code.
Cant figure out why this is happening. Anyone else having this problem and or solution?!
https://github.com/timgrossmann/InstaPy/issues/1117#issuecomment-360683143 I'm rollback to older version and it work
Just started getting this, any fixes? @ogerasymenko @Xander8 @lairdep23
it's weird, I have no such an issue in both old and new accaunts, I also tried with different window sizes, it still works fine...
_Maybe commenting for those pictures is disabled_
Do you get this error in every attempt commenting?
Can you share the image link where that error occured (can get from logs)
@lairdep23 that might be some beta design change at the time, that, please pastebin the inspected data from any of the images where error occured (right click on pic, copy it's link and enter in browser adress bar rather than clicking from tags or user's page..) from Chrome dev tools..
@ogerasymenko which version did you roll back to?
isn't it #1309
did it fully solve?
@uluQulu good question. I'm having similar problems and just noticed another error:
--> Invalid Like Element!
I followed the image link like you thought, and got a "missing" error. Wonder why that's happening...
but, when I follow the link from posts the get the "comment element not found" error, I load it on my computer and there is a comment element.
Anyone able to resolve this?
@uluQulu I also have the warning. It happens for both videos and photos. I checked and the comment section is enabled. For example: https://www.instagram.com/p/BfUdmnQD1rw/
It seems like this only happens for like_by_feed
- here I always get the warning and commenting never works. It works fine for like_by_tag
. Does that help, narrow it down?
hi @estebancortero
let's solve it
1. open comment_util.py
2. in open_comment_section()
function
replace
except WebDriverException:
print(missing_comment_elem_warning)
with
except WebDriverException:
print("Hey! I cannot click it :(") #this line is modified
AND after _this change_ show me the output in console _once it cannot comment..._
Hm, weird. Now the warning didn't occur at all and commenting worked fine. I'm not sure if I changed anything else that would explain this...
Here's the inside of my quickstart.py
:
session = InstaPy(username=insta_username,
password=insta_password,
use_firefox=True,
page_delay=25,
nogui=True)
session.switch_language = False
session.login()
# settings
session.set_upper_follower_count(limit=2500)
session.set_lower_follower_count(limit=50)
session.set_do_comment(True, percentage=30)
session.set_comments(['com1', 'com2'], media='Photo')
session.set_do_follow(enabled=True, percentage=50, times=2)
session.set_user_interact(amount=5, randomize=True, percentage=50, media='Photo')
# actions
session.unfollow_users(amount=20, onlyNotFollowMe=True)
session.like_by_tags(['tag1', 'tag2'], amount=20, media='Photo')
session.like_by_feed(amount=20, randomize=True, unfollow=True, interact=True)
session.unfollow_users(amount=20)
If the problem comes up again, I'll post the infos.
I ran it again and it finished again without the warning. I assume, the problem was that I didn't have user interactions specified before, i.e., I didn't have the line session.set_user_interact(amount=5, randomize=True, percentage=50, media='Photo')
. Is it possible that this caused the problem, considering that interact=True
in like_by_feed
?
I think, setting session.set_user_interact
solves the problem.
Argghhhh... It's working fine for me except I'm also getting the 'Warning: Comment Button Not Found: May cause issues with browser windows of smaller widths' and crash out.
Running Ubuntu 16.04.04 / Python 3.5.2
Tried the like_by_feeds vs like_by_tags as above, and same both ways
session.set_user_interact is in place
Just for fun tried changing the a & span button definitions in open_comment_section of comment_util.py to the current classes just in case.. no effect, so returned them to default.
Tried different sized windows, default size, smaller and fullscreen
I did notice that the page jumped down right before crashing out.
errors (personal stuff removed):
NFO [2018-03-15 08:20:24] [account] --> Image Liked!
--> Warning: Comment Button Not Found: May cause issues with browser windows of smaller widths
INFO [2018-03-15 08:20:53] [account] Session ended - 2018-03-15 08:20:53
INFO [2018-03-15 08:20:53] [account] --------------------
Traceback (most recent call last):
File "/home/name/InstaPy/instapy/comment_util.py", line 47, in comment_image
comment_input[0].clear()
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webelement.py", line 95, in clear
self._execute(Command.CLEAR_ELEMENT)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webelement.py", line 628, in _execute
return self._parent.execute(command, params)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: call function result missing 'value'
(Session info: chrome=65.0.3325.146)
(Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 4.13.0-36-generic x86_64)
Update: @uluQulu @ogerasymenko @Xander8 @lairdep23
(sorry if @'ing people isn't protocol, new here, and some others have done that..)
Re: above comment - The script IS actually putting the cursor in the comment box, THEN shuts down with the "Warning: Comment Button Not Found" error ..
Hi @MikeLewin
Check out the modification in my previous comment above
Then output the traceback with the error happened during commenting, it will help to diagnose correctly
I tried that, it says "Hey! I cannot click it :(" instead, then aborts
@MikeLewin
Fine, it is clear馃憣
You can revert back that modifiaction now
Also:
there isn't any other exception, right?
it would be cool to see the full traceback
I will troubleshoot the error soon
Sure, what do you need me to post? or is there a PM - thing?
Oh, no other exception
@MikeLewin
Just remove personal information like username.. then post the full traceback error outputted into console when error occured during commenting
Is this what you need?
Traceback (most recent call last):
File "quickstart.py", line 29, in
session.like_by_tags(['naturewalk','naturelover'], amount=100)
File "/home/myname/InstaPy/instapy/instapy.py", line 921, in like_by_tags
self.logfolder)
File "/home/myname/InstaPy/instapy/comment_util.py", line 47, in comment_image
comment_input[0].clear()
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webelement.py", line 95, in clear
self._execute(Command.CLEAR_ELEMENT)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webelement.py", line 628, in _execute
return self._parent.execute(command, params)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: call function result missing 'value'
(Session info: chrome=65.0.3325.146)
(Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 4.13.0-36-generic x86_64)
BTW I also tried adding interact=True to session.like_by_tags, and still crashed.
Traceback (most recent call last):
File "quickstart.py", line 29, in
session.like_by_tags(['naturewalk','naturelover'], amount=100, interact=True)
File "/home/myname/InstaPy/instapy/instapy.py", line 879, in like_by_tags
self.user_interact_media)
File "/home/myname/InstaPy/instapy/instapy.py", line 1002, in like_by_users
media)
File "/home/myname/InstaPy/instapy/like_util.py", line 318, in get_links_for_username
body_elem.send_keys(Keys.END)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webelement.py", line 479, in send_keys
'value': keys_to_typing(value)})
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webelement.py", line 628, in _execute
return self._parent.execute(command, params)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: call function result missing 'value'
(Session info: chrome=65.0.3325.146)
(Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 4.13.0-36-generic x86_64)
Right, @MikeLewin it's great馃憤now
Also @MikeLewin
From your experience, which features are affected by this commenting misbehaviour? (e.g. like_by_tags)
And does it opt out that error in each attempt of commenting or sometimes?
It happens every time, the first time it tries to comment - even though the cursor does go to the comment box correctly.
Always like_by_tags as far as I can see
Amazing @MikeLewin
We have got the required troubleshoot information now, let's solve it馃憠
Hi @MikeLewin
My initial concern is, since you have said, it finds comment box flawlessly, the problem can be some ad (_Get Mobile App!_) box at top of the page that prevents JS to send click..
Try this:
In comment_util.py open up open_comment_section()
function and modify like in below
1. import click_element
at top of file near other _imports_
from .util import click_element
2. replace
try:
browser.execute_script(
"arguments[0].click();", comment_elem[0])
except WebDriverException:
print(missing_comment_elem_warning)
with
try:
click_element(browser, comment_elem[0])
except WebDriverException:
print("Failed to click comment button :/")
raise
Due to having no access to my computer I figured this out by reading code from my phone, that's why I could not test. In case of it does not work, please let me know to investigate further.
Thanks @uluQulu
Unfortunately, still not working.
HOWEVER... I did see it had pasted the comment into the textarea this time, THEN crashed out with the 'comment button not found' error.
Is it the submit button? I had thought it was the little speech bubble button, to put the cursor in the box..
Traceback (most recent call last):
File "quickstart.py", line 29, in
session.like_by_tags(['roamtheplanet','earthpics'], amount=100)
File "/home/myname/InstaPy/instapy/instapy.py", line 921, in like_by_tags
self.logfolder)
File "/home/myname/InstaPy/instapy/comment_util.py", line 57, in comment_image
"arguments[0].value = '" + rand_comment + " ';", comment_input[0])
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 627, in execute_script
'args': converted_args})['value']
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: call function result missing 'value'
(Session info: chrome=65.0.3325.146)
(Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 4.13.0-36-generic x86_64)
@MikeLewin
Yeah right, line 57 points out that submit function
I got a hint but let's test why it can't send submit before changes to alternatives
Try this:
replace
comment_input[0].submit()
with
try:
comment_input[0].submit()
except:
raise
Now python will raise the exact error occured for us
Post the full traceback again
Sorry, I didn't see your reply.
Same, except now there isn't the 'comment button not found' error, it just puts the comment in fine, then stops before submitting
Traceback (most recent call last):
File "quickstart.py", line 29, in
session.like_by_tags(['roamtheplanet','earthpics'], amount=100)
File "/home/myname/InstaPy/instapy/instapy.py", line 921, in like_by_tags
self.logfolder)
File "/home/myname/InstaPy/instapy/comment_util.py", line 58, in comment_image
"arguments[0].value = '" + rand_comment + " ';", comment_input[0])
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 627, in execute_script
'args': converted_args})['value']
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: call function result missing 'value'
(Session info: chrome=65.0.3325.146)
(Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 4.13.0-36-generic x86_64)
Thanks SO much for your help with this :)
Okay @MikeLewin for some reasons, submit cannot accomplish it's job
Now you can revert back last test lines
Let's send return key instead
from selenium.webdriver.common.keys import Keys
comment_input[0].submit()
with
comment_input[0].send_keys(Keys.RETURN)
sleep(1)
If this does not work either, then it's not submit function's problem. We should do it inside JS then..
ok, testing now
:( Still the same I'm afraid
The 'comment button not found' message has gone, now it just stops..
INFO [2018-03-16 11:05:50] [myaccount] --> Image Liked!
INFO [2018-03-16 11:05:54] [myaccount] Session ended - 2018-03-16 11:05:54
INFO [2018-03-16 11:05:54] [myaccount] --------------------
Traceback (most recent call last):
File "quickstart.py", line 29, in
session.like_by_tags(['roamtheplanet','earthpics'], amount=100)
File "/home/myname/InstaPy/instapy/instapy.py", line 921, in like_by_tags
self.logfolder)
File "/home/myname/InstaPy/instapy/comment_util.py", line 59, in comment_image
"arguments[0].value = '" + rand_comment + " ';", comment_input[0])
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 627, in execute_script
'args': converted_args})['value']
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: call function result missing 'value'
(Session info: chrome=65.0.3325.146)
(Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 4.13.0-36-generic x86_64)
@MikeLewin
Try replacing RETURN
with ENTER
Still the same..
Traceback (most recent call last):
File "quickstart.py", line 29, in
session.like_by_tags(['roamtheplanet','earthpics'], amount=100)
File "/home/myname/InstaPy/instapy/instapy.py", line 921, in like_by_tags
self.logfolder)
File "/home/myname/InstaPy/instapy/comment_util.py", line 59, in comment_image
"arguments[0].value = '" + rand_comment + " ';", comment_input[0])
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 627, in execute_script
'args': converted_args})['value']
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python3.5/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: call function result missing 'value'
(Session info: chrome=65.0.3325.146)
(Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 4.13.0-36-generic x86_64)
@MikeLewin
Have a look at this 馃敡
It seems to be a web browser & its selenium driver incompatibility
Meanwhile, we must find another stable solution cos this problem happened many times
checking..
I agree, this is a totally new installation, so everything is the newest versions. That means more people will start to experience this as they update.
downloaded chromedriver 2.3.6 testing now
IT WORKS WITH 2.3.6!!!!! Yayyyyyyyyyyyyyyyy :)
Thank you SO much uluQulu, you're awesome!
I'm having the same issue. I see the below inside of Terminal while the script is running:
--> Warning: Comment Button Not Found: May cause issues with browser windows of smaller widths WARNING [2018-06-10 17:20:52]
--> Warning: Comment Action Likely Failed: Comment Element not found INFO [2018-06-10
--> Commented: This is great!
It shows "commented: this is great" even though it never actually comments on anything.
If I add session.set_user_interact
then everything seems to run without the above warning about the browser window size and comment element not found but the issue I continue to run into when using set_user_interact
is that it comments twice on every post.
I just set everything up again from scratch on my end using latest packages and latest InstaPy files inside of a virtual environment. I also have the latest Chrome Driver 2.40 and I'm still seeing the above issues. Here's my quickstart.py:
import os
import time
import random
from tempfile import gettempdir
from selenium.common.exceptions import NoSuchElementException
from instapy import InstaPy
insta_username = 'xxx'
insta_password = 'xxx'
# set headless_browser=True if you want to run InstaPy on a server
# set these in instapy/settings.py if you're locating the
# library in the /usr/lib/pythonX.X/ directory:
# Settings.database_location = '/path/to/instapy.db'
# Settings.chromedriver_location = '/path/to/chromedriver'
like_tags = ['alabamafamilyphotographer', 'alaskafamilyphotographer', 'arizonafamilyphotographer', 'arkansasfamilyphotographer', 'californiafamilyphotographer', 'coloradofamilyphotographer', 'connecticutfamilyphotographer', 'delawarefamilyphotographer', 'floridafamilyphotographer', 'georgiafamilyphotographer', 'hawaiifamilyphotographer', 'idahofamilyphotographer', 'illinoisfamilyphotographer', 'indianafamilyphotographer', 'iowafamilyphotographer', 'kansasfamilyphotographer', 'kentuckyfamilyphotographer', 'louisianafamilyphotographer', 'mainefamilyphotographer', 'marylandfamilyphotographer', 'massachusettsfamilyphotographer', 'michiganfamilyphotographer', 'minnesotafamilyphotographer', 'mississippifamilyphotographer', 'missourifamilyphotographer', 'montanafamilyphotographer', 'nebraskafamilyphotographer', 'nevadafamilyphotographer', 'newhampshirefamilyphotographer', 'newjerseyfamilyphotographer', 'newmexicofamilyphotographer', 'newyorkfamilyphotographer', 'northcarolinafamilyphotogrpher', 'northdakotafamilyphotographer', 'ohiofamilyphotographer', 'oklahomafamilyphotographer', 'oregonfamilyphotographer', 'pennsylvaniafamilyphotographer', 'rhodeislandfamilyphotographer', 'southcarolinafamilyphotographer', 'southdakotafamilyphotographer', 'tennesseefamilyphotographer', 'texasfamilyphotographer', 'utahfamilyphotographer', 'vermontfamilyphotographer', 'virginiafamilyphotographer', 'washingtonfamilyphotographer', 'westvirginiafamilyphotographer', 'wisconsinfamilyphotographer', 'wyomingfamilyphotographer']
like_tags = random.sample(like_tags, len(like_tags))
session = InstaPy(username=insta_username,
password=insta_password,
headless_browser=False,
multi_logs=True)
try:
session.login()
# settings
session.set_relationship_bounds (
enabled=True,
potency_ratio=None,
delimit_by_numbers=True,
max_followers=None,
max_following=None,
min_followers=100,
min_following=None
)
session.set_user_interact(
amount=1,
percentage=100,
randomize=True,
media='Photo')
session.set_do_comment(True, percentage=100)
session.set_comments([u'Nice shot! @{} :heart:', u'Really nice! @{} :thumbsup:', u'Loving your work! @{} :smile:', u'This is :fire: @{}', u'Great work! @{} :heart:', u'Love it! @{} :heart: :thumbsup:', u'Very nice! @{}'])
# actions
session.like_by_tags(like_tags, amount=100, interact=True)
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()
Here's a couple screenshots I took after adding set_user_interact
which left two comments on two images back to back before I just stopped the script from running as I can't have double comments on everything as that looks quite spammy :)
Any new developments on this? I hadn't used InstaPy for a long time because of this issue as it was pointless. Just upgraded everything to the latest and greatest and still have this issue when trying to comment.
I tried 2.3.6 version of Chromedriver but the issue remains.
Hey @deronsizemore
Can you write the details on your current situation?
Maybe I can help.
@uluQulu Sorry, definitely could have given more context. I'm up to date on everything as of yesterday and continue to get:
Warning: Comment Button Not Found: May cause issues with browser windows of smaller widths
WARNING [2018-08-25 16:54:13] [famsnap] --> Warning: Comment Action Likely Failed: Comment Element not found
Here's my settings/actions:
#settings
session.set_relationship_bounds (
enabled=True,
potency_ratio=None,
delimit_by_numbers=True,
max_followers=None,
max_following=None,
min_followers=100,
min_following=None
)
session.set_do_comment(True, percentage=100)
session.set_comments([u'Nice shot! @{} :heart:', u'Really nice! @{} :thumbsup:', u'Loving your work! @{} :smile:', u'This is :fire: @{}', u'Great work! @{} :heart:', u'Love it! @{} :heart: :thumbsup:', u'Very nice! @{}'])
# actions
session.unfollow_users(amount=50, allFollowing=True, style="LIFO", sleep_delay=0)
session.like_by_tags(like_tags, amount=100, interact=True)
I see.
@deronsizemore, sometimes those warning, errors are misleading and even though it writes "_Cannot comment_" it comments.
Can you observe that commenting action in web browser and verify if it really does not comment on posts with comments enabled?
@uluQulu Yeah I'm watching it work in the browser and it's not commenting.
Same problem here
--> Warning: Comment Button Not Found: May cause issues with browser windows of smaller widths
INFO [2018-08-28 18:53:04] [thename] --> Commented: b'Hey atbla aba ;) that is really a nice post'
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
Most helpful comment
IT WORKS WITH 2.3.6!!!!! Yayyyyyyyyyyyyyyyy :)
Thank you SO much uluQulu, you're awesome!