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?
Ich brauche einen Screenshot mit Selenium und lade das Bild mit FTP hoch.
[code]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)
[/code]
Wie gebe ich diesen Code aus?