I have to upload file (drop zone -> click ->open window to choose file)
I've tried:
addphoto.send_keys("C:\\files\\file.jpg")
But it doesn't work. Is there any robot to handle with new window opened?
Putting a file name in dropzone hidden input works fine. This should get you going.
upload_file = driver.find_element_by_css_selector('.dz-hidden-input')
data_file = Path(__file__).parent / "test_file.txt"
logging.debug("data_file: %s", data_file)
assert data_file.exists()
upload_file.send_keys(str(data_file))
assert driver.find_element_by_css_selector('.dz-image').is_displayed()
I did it! Just pip install -U pyautoit
then
import autoit
autoit.win_wait_active("File Upload", 5)
autoit.send(os.path.join("path"))
autoit.send("{ENTER}")
Works ok :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With