Upload image through MacOS window with Selenium
Disable the file picker and call sendKeys
on an <input type="file">
which is by design the only type of element allowed to receive/hold a file:
# disable the OS file pickerbrowser.execute_script(""" document.addEventListener('click', function(evt) { if (evt.target.type === 'file') evt.preventDefault(); }, true) """)# make an <input type="file"> availablebrowser.find_element_by_id('uploadifive-FileNameUpload')\ .click()# assign the file to the <input type="file">browser.find_element_by_css_selector('input[type=file]')\ .send_keys('path/to/MyImage.jpeg')