I was trying to create a simple python program using selenium that needs to find and click the follow button.
This is the HTML Code:
<div class=" qF0y9 Igw0E rBNOH YBx95 ybXk5 _4EzTm soMvl " id="f2d16737c928a4">
<button class="sqdOP L3NKy y3zKF " type="button">Abonnieren</button>
</div>
My python code:
example = driver.find_element_by_xpath("//button[contains(@class,'sqdOP L3NKy y3zKF ')]")
example.click
Every time I try it just gives me: "selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element"
If you want to take a look at the site you need to log in and go to the suggestions page where Instagram suggests people you should follow: https://www.instagram.com/explore/people/
driver.find_element_by_xpath("//button[.='Abonnieren']").click()
Just look for the button with that text and click it.