Uploading Files

To upload files, we provide the click_and_upload endpoint and SDK function, which takes in an element description and a file to upload. The element description must be an element that would typically open the operating system file upload dialog.

In this example, we have to run click_and_upload with the “Click or drag and drop” section and our desired file. We’re using a file called “logo.png” here.

upload_file.py
from simplex import Simplex
import os
simplex = Simplex(api_key="your_api_key")
simplex.create_session(proxies=False)
simplex.goto("https://simplex.sh/upload-example.html")
simplex.click_and_upload("Click or drag and drop an image", "logo.png")
print(simplex.extract_text("File name"))