Reputation: 3
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:
Here is the link to the screenshot of what I'm talking about:
I got 2 problems right now,
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)
Are there any solution to this?
Upvotes: 0
Views: 124
Reputation: 1788
You should use Selenium expected conditions. Don't just find elements and click them, wait for them to be enabled or clickable:
driver.wait.until(ExpectedCondition.element_to_be_clickable((By.XPATH, "myXpath"))).click()
driver.wait.until(ExpectedCondition.element_to_be_clickable((By.CSS, "myCSS"))).click()
When you try to click on an element before it is actually clickable - you are going to get errors.
Upvotes: 1