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

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Wie mache ich einen Screenshot und lade ein Bild mit FTP in Python hoch?

by Guest » 11 Jan 2025, 11:15

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?

Top