im working on bot Instagram like and unlike with python and selenium..
example on >> https://www.instagram.com/explore/tags/healtyfood/ > on post
i use CSS_SELLECTIOR
to navigate to the like icon
, then use get_attribute
to get the aria-label: 'Like'
or aria-label: 'Unlike'
..
But the atribute didnt works..... thank for help..
this i code i've tried..
ld = driver.find_element(By.CSS_SELECTOR, '._aamw') #Span
lc = ld.get_attribute('aria-label') == 'Unlike' #Aria-label inner the span
if lc:
print('[INFO] : Already liked this post!')
else:
print('[INFO] : Ready to like...')
ld.click()
print('[INFO] : Liking Done!')
this the ig post Code:
<span class="_aamw">
<button class="_abl-" type="button">
<div class="_abm0 _abm1">
<svg aria-label="Like" class="_ab6-" color="#8e8e8e" fill="#8e8e8e" height="24" role="img" viewBox="0 0 24 24" width="24">
<path d=".....">
</path>
</svg>
</span>
</div>
</button>
</span>