【发布时间】: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