dms-codes / tweet_to_twitter

Twitter Automation using Selenium This Python script demonstrates how to automate posting a tweet on Twitter using the Selenium web automation library. It opens a Chrome web browser, logs into a Twitter account, composes a tweet, and posts it.
https://github.com/dms-codes/tweet_to_twitter
3 stars 1 forks source link

upload videos #1

Open Spectraderr opened 11 months ago

Spectraderr commented 11 months ago

try to upload video with send_keys, getting an error on twitter page. Do you have a solution ?

dms-codes commented 11 months ago

Hi @Spectraderr ,

I haven't tried to upload video. But for picture, I use the following:

    input_e = driver.find_element(by=By.XPATH, value="//input[@data-testid='fileInput']")
    input_e.send_keys(os.path.join(os.getcwd(), "foto_twitter.jpg"))
    time.sleep(2)

Cheers, Donny

Spectraderr commented 11 months ago

There is no problem uploading photos, but unfortunately the video is not uploaded. There is no problem when doing it manually from the file selector. If you do the process with selenium, the video upload gives an error.