如何使用python中的硒单击Instagram评论按钮
我基本上是在试图写一个机器人,该机器人会评论我时间表的最新帖子。 我有使用硒来查找评论按钮的问题。 我尝试了各种寻找它的方法,但仍然没有成功。
HTML:
<svg aria-label="Kommentar" class="_8-yf5 " color="#262626" fill="#262626" height="24" role="img" viewBox="0 0 24 24" width="24"><path d="M20.656 17.008a9.993 9.993 0 10-3.59 3.615L22 22z" fill="none" stroke="currentColor" stroke-linejoin="round" stroke-width="2"></path></svg>
代码试验:
driver.find_element_by_xpath('/html/body/div\[5\]/div\[2\]/div/article/div\[3\]/section\[3\]/div/form/textarea').click()
有人可以在这里帮助我吗?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
单击注释按钮 kommentar webdriverwait element_to_be_clickable() 您可以使用以下任何一个 em> :
使用 css_selector :
使用 xpath :
注意:您必须添加以下导入:
The click on the Comment button Kommentar within Instagram you need to induce WebDriverWait for the element_to_be_clickable() and you can use either of the following locator strategies:
Using CSS_SELECTOR:
Using XPATH:
Note: You have to add the following imports :
只需使用 ENTER 方法:
Just use ENTER method: