I found out that https://github.com/timgrossmann/InstaPy/pull/47 fixes an issue that had been since overwritten in master (see PR for details). That caused the old issue to popup (Element not clickable at point, blah blah). I then fixed the issue in my code to click the like button with execute_script.
But now I'm running into another issue similar, but different:
except: Message: unknown error: Element <a href="/explore/tags/sun/?max_id=1691136460033415146" class="_1cr2e _epyes">...</a> is not clickable at point (381, 340). Other element would receive the click: <div class="_eyflt">...</div>
(details not important)
Notice the element we're trying to click does not have the same href as the errors this PR fixes.
This PR fixes exceptions on buttons with href="#" or no href at all (Ex https://github.com/timgrossmann/InstaPy/issues/1216)
I'm seeing an exception (above) with href="/explore/tags/[some_tag]/?max_id=[some_long_number]" (Ex https://github.com/timgrossmann/InstaPy/issues/1217)
This brings up the question of standard clicking among all elements that InstaPy interacts with. I'm not a web developer, but I do see some discrepancies that is causing issues.
What if any advantages do we have over using Selenium's .click(), .send_keys("\n"), or browser.execute_script("document.getElementsByClassName('class')[0].click()")?
https://github.com/timgrossmann/InstaPy/commit/3e4b22c8a3a0d033be3f2fe951153f4728fdcc18 This commit overwrites .click() in favor of .send_keys("\n") because of a firefox/pi issue
https://github.com/timgrossmann/InstaPy/commit/049f0e190f5654d9249a9567fd541ed3b314e824 This commit overwrites .send_keys("\n") in favor of .click()
https://github.com/timgrossmann/InstaPy/pull/589 https://github.com/timgrossmann/InstaPy/commit/049f0e190f5654d9249a9567fd541ed3b314e824 This here is a PR and commit that favors .click() instead of script (execute_script) based clicking.
It seems as though developers are overwriting this line back and forth between the three methods.
Here's everyone's chance. Explain to us why you prefer one over the other, advantages and disadvantages. This should hopefully start people talking and taking action so we have fewer errors while running the project.
@blesson3 You are absolutely right, we have to get this fixed and especially standardized asap
Running a local setup on chrome. I had to change from .click to .send_keys because click was not clicking on elements that were obscured by other things like instagram's popup to get the app.
hi my message error
Traceback (most recent call last):
File "start.py", line 24, in
session.like_by_tags(['musculation','teamshape','getfit','fit','fitnessmodel','fitspo','crossfit','muscu','shooting','fitfrenchies'], amount=10)
File "/Users/Retina/Desktop/Instapy/instapy/instapy.py", line 659, in like_by_tags
self.logger)
File "/Users/Retina/Desktop/Instapy/instapy/like_util.py", line 415, in check_link
"return window._sharedData.entry_data.PostPage")
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 465, in execute_script
'args': converted_args})['value']
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 236, in execute
self.error_handler.check_response(response)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 192, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Cannot read property 'entry_data' of undefined
(Session info: headless chrome=63.0.3239.132)
(Driver info: chromedriver=2.35.528157 (4429ca2590d6988c0745c24c8858745aaaec01ef),platform=Mac OS X 10.13.2 x86_64)
macbook-pro-de-mac:instapy Retina$
@spacewaffle Why use .send_keys("\n") and not execute_script?
Ex. browser.execute_script("document.getElementsByClassName('class')[0].click()")
Haven't tried that yet. I'm on a slightly older instapy version due to some kind of memory leak issue in the latest one.
Since this issue hasn't gotten enough attention, I'll attempt a fix.
@blesson3 Awesome, thank you!
@timgrossmann see the following PR for my attempted fix: https://github.com/timgrossmann/InstaPy/pull/1248
PR #1248 has been tested and merged
Thanks!
Most helpful comment
@spacewaffle Why use
.send_keys("\n")and notexecute_script?Ex.
browser.execute_script("document.getElementsByClassName('class')[0].click()")