I'm processing a website that requires to upload files with an "open file dialog".
Here is the setup:
import selenium
from selenium import webdriver
browser = webdriver.Chrome(executable_path=r"C:\Users\PC\Documents\Downloads\chromedriver.exe")
browser.maximize_window()
filename = '24_bit_fixed.wav'
folder = 'C:\\Users\\PC\\Documents\\Downloads\\'
path = folder + filename
And this is the tricky part:
NewRelease_Upload = '/html/body/ui-view/sections-list-modal/loeschen-modal/div/div[1]/div[3]/loeschen-modal-footer/button/div[1]/div[2]/span'
#browser.find_element_by_id("").send_keys(path)
#browser.find_element_by_xpath(NewRelease_Upload).send_keys(path)
I know that if there were an id, I could easily use these two lines and therefore avoid the open file dialog box:
browser.switch_to_frame(0)
browser.find_element_by_id("something").send_keys(path)
But there is neither an id nor such frame on the website and I'm trying to do it with selenium
only without pywinauto
.