我一直在尝试使用python为Instagram创建自动评论工具。执行代码时,我在浏览器中收到消息“无法评论”
如何解决?
def comment(self, commentary, amount):
"""
Commenting on a publication.
Receives as parameters the commentary content (commentary)
And how many comments it will make (amount)
"""
number = 0
while number < amount:
self.driver.find_element_by_xpath("/html/body/div[4]/div[2]/div/article/div[2]/section[3]/div/form/textarea")\
.send_keys(commentary)
self.driver.find_element_by_xpath("/html/body/div[4]/div[2]/div/article/div[2]/section[3]/div/form/button")\
.click()
number += 1
sleep(10)
while number < amount:
self.driver.find_element_by_xpath("//textarea[@class='Ypffh']").send_keys(commentary)
self.driver.find_element_by_xpath("//button[@type='submit']").click()
number += 1
sleep(10)
xpath错误,您可以尝试