Importing Image To Google Forms Via Selenium Driver In Python
I am trying to import image to the google form. I am failing to pass keys to the element via xpath. It seems it is a hidden element. I have tried to execute scripts to unhide it,
Solution 1:
On clicking the ADD FILE button in Google Forms, it opens up a pop-up, which is an iframe
. An iframe
is basically an HTML page embedded into another one. In order to anything with it, you have to tell Selenium to switch the context to that iframe
.
Check this SO question which explains how you'd go about switching context to an iframe
. For your specific case, i.e. Google Forms, the code would be ―
iframe = driver.find_element_by_class_name('picker-frame')
driver.switch_to.frame(iframe)
input_field = driver.find_element_by_xpath('//input[@type="file"]')
Post a Comment for "Importing Image To Google Forms Via Selenium Driver In Python"