I'm trying to make an Instagram bot to like a post if it's unliked, and to ignore it if it's already liked
I've managed to grab the div element and click it, but for the like detection code I need the attribute for "aria-label"
or "fill"
for the bot to specify if the post is liked or not, but I haven't managed to grab the svg
element to do so.
Here's the like button structure
and here's my code:
like_button = self.driver.find_element_by_xpath(
'//*[@id="react-root"]/section/main/div/div/article/div[3]/section[1]/span[1]/button/div')
like_icon=like_button.find_element_by_xpath(
'//*[@id="react-root"]/section/main/div/div/article/div[3]/section[1]/span[1]/button/div/span/svg')
Whenever i run it an error occurs:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="react-root"]/section/main/div/div/article/div[3]/section[1]/span[1]/button/div/span/svg"}