I am unable to locate the 'File Upload' window while writing automation script for web page to upload the file.
I have tried with these two different scripts to achieve this:But 'Unable to locate 'File Upload' /'fileUploadID' exception is thrown.
(a)
driver.find_element_by_xpath('//img[@src="/img/white_upload.png"]').click() #Upon clicking this image ,File upload window opens
wait = WebDriverWait(driver, 10)
wait.until(EC.new_window_is_opened)
driver.switch_to.window("File Upload")
element=driver.find_element_by_name("File name")
element.send_keys("C:\\Users\\ranjana.palanivel\\Aaj Jane Ki Zid Na Karo.mp3")
(b)
driver.find_element_by_xpath('//img[@src="/img/white_upload.png"]').click() #Upon clicking this image ,File upload window opens
wait = WebDriverWait(driver, 10)
wait.until(EC.new_window_is_opened)
filepath=driver.find_element_by_id("fileUploadId")
filepath.send_keys("C:\\Users\\ranjana.palanivel\\Aaj Jane Ki Zid Na Karo.mp3")
Thanks & Regards