Wie mache ich einen Screenshot und lade ein Bild mit FTP in Python hoch?Python

Python-Programme
Guest
 Wie mache ich einen Screenshot und lade ein Bild mit FTP in Python hoch?

Post by Guest »

Ich brauche einen Screenshot mit Selenium und lade das Bild mit FTP hoch.

Code: Select all

from selenium import webdriver

driver = webdriver.Chrome()
image= ""
driver.get(image)
image_element = driver.find_element(By.TAG_NAME, "img")
image_data = image_element.screenshot_as_png
file_path = "/domains/example.com/public_html/file/"

with FTP('ip', 'user', 'pass') as ftp, open(image_data, 'rb') as file:
ftp.storbinary(f'STOR {file_path + image_data.name}', file)
Wie gebe ich diesen Code aus?

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post