so I want to do an automated testing on an iframe (input image). Here is what I have done so far:
WebDriverWait(driver, 1000).until(EC.frame_to_be_available_and_switch_to_it(driver.find_element("xpath","//div[@id='el_banner_url_upload']//iframe")))
upload_image = driver.find_element("xpath", "//input[@name='images']")
upload_image.send_keys(str(d_image))
driver.switch_to.default_content()
For the flow:
- I click on a button inside the iframe
- It opens my windows folder, then I select a picture I want to upload
- The image uploaded and it gives a preview + a link to the image that is generated automatically by the website is shown on the field below the displayed image
Here is the link to the screenshot of what I'm talking about:
I got 2 problems right now,
- After running the script, it works well (didn't give any error on the command). The "upload" button is gone now. But, the image is not shown on the display and there are no link generated. As shown in this screenshot. Tried inspect it, and found this error on the console:
Uncaught TypeError: Cannot read properties of undefined (reading 'showQuality')
at HTMLFormElement.add (pic-embed.js:173:35)
at $.<computed>.<computed>._trigger (jquery.ui.widget.js:489:13)
at File.<anonymous> (jquery.fileupload.js:846:31)
at Function.each (jquery.js:4:5347)
at $.<computed>.<computed>._onAdd (jquery.fileupload.js:840:15)
at $.<computed>.<computed>._onAdd (jquery.ui.widget.js:105:25)
at Object.<anonymous> (jquery.fileupload.js:1016:26)
at c (jquery.js:4:26036)
at Object.add [as done] (jquery.js:4:26346)
at Object.always (jquery.js:4:27212)
- The iframe would randomly not refreshed correctly, this too I couldn't figure out how. If this happens, the script couldn't run. Here is the screenshot of when the iframe didn't refresh correctly
Are there any solution to this?