Instapy: Takes about a minute: browser.find_elements_by_xpath("//a[@role='button']/span[text()='Unlike']")

Created on 10 Oct 2017  路  7Comments  路  Source: timgrossmann/InstaPy

Debuging:

def like_image(browser):
    """Likes the browser opened image"""
    print('22', str(datetime.now()))
    like_elem = browser.find_elements_by_xpath("//a[@role='button']/span[text()='Like']/..")
    print('33', str(datetime.now()))
    liked_elem = browser.find_elements_by_xpath("//a[@role='button']/span[text()='Unlike']")
    print('44', str(datetime.now()))

I got:
22 2017-10-10 13:05:08.441828
33 2017-10-10 13:05:08.489831
44 2017-10-10 13:05:58.497691

  • It reproduce all the time.

Is it only in my laptop (7 years old i5 gen2)

Sion.

help wanted wontfix

Most helpful comment

hard to understand

All 7 comments

hard to understand

Is it only in my run ? Anyone also experince it ?

like_elem = browser.find_elements_by_xpath("//a[@role='button']/span[text()='Like']/..")
If image already liked, than this element also take about 50 sec.
running over all xpath maybe is not a good method ? (SLOW)

I think that you are saying that the xpath method is super slow. It's interesting that the first time through looking for like_elem it runs just fine but when it was looking for liked_elem it runs slowly.

edit: I'm seeing the same issue. When running the line of code to get liked_elem it takes ~25 seconds consistently however when looking for like_elem there isn't a slowdown. As a really hacky way to make the code run faster I made it only look for liked_elem if the image wasn't already liked. I don't really understand the browser.find_elements_by_xpath() to be able to suggest a cause or fix.

I did the same I am not looking for unlike since if like did not found, it is binary options ....
BTW, it is not surprising, if the elem if found it not need to search for the rest of the page...

same here

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

v77v picture v77v  路  3Comments

harrypython picture harrypython  路  3Comments

deronsizemore picture deronsizemore  路  3Comments

seuraltimez picture seuraltimez  路  3Comments

ediooo picture ediooo  路  3Comments