【发布时间】:2022-01-13 20:09:21
【问题描述】:
我正在尝试使用 selenium 创建一个简单的 python 程序,该程序需要找到并单击关注按钮。
这是 HTML 代码:
<div class=" qF0y9 Igw0E rBNOH YBx95 ybXk5 _4EzTm soMvl " id="f2d16737c928a4">
<button class="sqdOP L3NKy y3zKF " type="button">Abonnieren</button>
</div>
我的python代码:
example = driver.find_element_by_xpath("//button[contains(@class,'sqdOP L3NKy y3zKF ')]")
example.click
每次我尝试它都会给我:“selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element”
如果您想查看该网站,您需要登录并转到 Instagram 建议您应该关注的人的建议页面:https://www.instagram.com/explore/people/
【问题讨论】:
-
这个按钮是你试图点击关注按钮吗?
-
@Luke Hamilton 是的
-
让我知道您对我的回答的看法!乐于助人。
标签: python python-3.x selenium instagram