Selenium Instagram - Just need Correct Xpath

CoderFromHell

Power Member
Joined
Mar 19, 2019
Messages
727
Reaction score
341
Alright so most of the code for the project Im working on is already written (in Python), I just need the xpath of the heart of a comment in the comment section. The xpath I use doesn't work, Im clearly doing something wrong. o.o

Im creating an Instagram bot in Selenium basically to like certain comments with other Instagram accounts, but Im unable to .click() on the xpath of Instagram's heart in the comment section of a certain comment. I really just need the correct xpath of the heart in Instagram's comment section, and I'll be done with this.



This is the xpath I've been using, that doesn't work.
//*[@id="react-root"]/section/main/div/div[1]/article/div[3]/div[1]/ul/div[2]/ul/div/li/div/span/div/button/svg'

I grabbed this xpath from the little heart on Instagram next to the link of the comment I choose to like
 
Alright so most of the code for the project Im working on is already written (in Python), I just need the xpath of the heart of a comment in the comment section. The xpath I use doesn't work, Im clearly doing something wrong. o.o

Im creating an Instagram bot in Selenium basically to like certain comments with other Instagram accounts, but Im unable to .click() on the xpath of Instagram's heart in the comment section of a certain comment. I really just need the correct xpath of the heart in Instagram's comment section, and I'll be done with this.



This is the xpath I've been using, that doesn't work.
//*[@id="react-root"]/section/main/div/div[1]/article/div[3]/div[1]/ul/div[2]/ul/div/li/div/span/div/button/svg'

I grabbed this xpath from the little heart on Instagram next to the link of the comment I choose to like
Never mind, figured it out. Correct Xpath was:

//span/div/button[*[local-name()='svg']/@Aria-label='Like']
 
Selenium is easily detectable. If the site wants to detect it.

So it actually depends if Instagram runs bot checks or instead counts your actions and looks for bad patterns.
 
Alright so most of the code for the project Im working on is already written (in Python), I just need the xpath of the heart of a comment in the comment section. The xpath I use doesn't work, Im clearly doing something wrong. o.o

Im creating an Instagram bot in Selenium basically to like certain comments with other Instagram accounts, but Im unable to .click() on the xpath of Instagram's heart in the comment section of a certain comment. I really just need the correct xpath of the heart in Instagram's comment section, and I'll be done with this.



This is the xpath I've been using, that doesn't work.
//*[@id="react-root"]/section/main/div/div[1]/article/div[3]/div[1]/ul/div[2]/ul/div/li/div/span/div/button/svg'

I grabbed this xpath from the little heart on Instagram next to the link of the comment I choose to like


You solved this already? I have the code for it and I can dig out if you still need it
 
Here is xpath: //button//*[name()='svg' and @ aria-label='Like']/ancestor::button

This xpath will give you all like buttons on comments.

If you need specific one use this: (//button//*[name()='svg' and @ aria-label='Like']/ancestor::button)[4]

This means the xpath will show you the 4th comment's like button.

Please delete the space between @ and aria.
 
Selenum is bad if you use stock webdriver without any modification of browser driver values to be spoofed to look like a real browser.
 
Back
Top