【问题标题】:Upload file to Twitter with Selenium Python使用 Selenium Python 将文件上传到 Twitter
【发布时间】:2021-01-09 22:00:38
【问题描述】:

我正在尝试制作一个 twitter 机器人,并且我正在使用 Selenium 和 Python。

我已经尝试过这个页面的方法:Upload file with Selenium in Python

HTML:

<input accept="image/jpeg,image/png,image/webp,image/gif,video/mp4,video/quicktime,video/webm" multiple="" tabindex="-1" type="file" data-focusable="true" class="r-8akbif r-orgf3d r-1udh08x r-u8s1d r-xjis5s r-1wyyakw" data-testid="fileInput">

代码:

button = driver.find_element_by_xpath('//*[@id='react-root']/div/div/div[2]/main/div/div/div/div/div/div[2]/div/div[2]/div[1]/div/div/div/div[2]/div[2]/div/div/div[1]/input')
button.click()
button.send_keys('C://Users/Yagmur/Desktop/TwitterBot/2020-09-21data.png')

我不能上传图片这个代码不起作用enter image description here

【问题讨论】:

    标签: python selenium twitter bots


    【解决方案1】:

    我认为 Selenium 仅适用于网页。您可以尝试使用请求,但如果没有 Twitter API,很难使用 Twitter 抓取/工作..

    【讨论】:

      猜你喜欢
      • 2021-02-08
      • 1970-01-01
      • 2017-09-16
      • 1970-01-01
      • 2017-10-02
      • 1970-01-01
      • 2012-01-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多