from os import listdir
from os.path import isfile,join
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.options import Options
import time

PROXY = "66.29.154.103:3128" #Acá va el proxy en formato xx.xx.xxx.xxx:xxxx

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--proxy-server=%s' % PROXY)

mypath = 'C:\\Users\\rodri\\Pictures\\compu' #acá va la dirección del folder con las imágenes que quieres subir (si tu folder tiene la forma C:\carpeta... tienes que duplicar los '\')
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
driver = webdriver.Chrome(options=chrome_options)
driver.maximize_window()
driver.get('http://whatismyipaddress.com')
time.sleep(20)
hilo = 'https://www.hispachan.org/pol/res/1721716.html' #acá va la dirección del hilo en el cual quieres hacer el dump

for filename in onlyfiles:
    ubicacion=mypath+'\\'+filename
    print (ubicacion)
    driver.get(hilo)
    element=driver.find_element(By.XPATH,'//*[@id="postform"]/table/tbody/tr[3]/td/input') #ubica la posición del botón seleccionar archivo
    element.send_keys(ubicacion) #adjunta la ruta del archiv
    element=driver.find_element(By.XPATH,'//*[@id="postform"]/table/tbody/tr[1]/td/input').click() #ubica la posición del botón Enviar y le hace click
    print ('enviando una imagen')
    time.sleep(20)
Edit
Pub: 16 May 2022 15:35 UTC
Views: 438