无法启动ig评论bot

问题描述 投票:-4回答:1

我一直在尝试使用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)
python html python-3.x selenium dom
1个回答
0
投票
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错误,您可以尝试

© www.soinside.com 2019 - 2024. All rights reserved.