0

I have been trying to find a way to select a dropdown option from google forms through selenium and python but have thus far been unsuccessful.

I tried several ways including the Select class (which does not work due to the dropdown form not using the select tag). As well as XPATH. But have only got so far as to click on the dropdown but not being able to select the options within the said dropdown list. Any help would be greatly appreciated!

I need to be able to specify which dropdown option to choose based on the text/value in the various options.

CODE:

browser.find_element_by_xpath("//div[@class='quantumWizMenuPaperselectOptionList']").click() 
browser.find_element_by_xpath("//div[@class='freebirdThemedSelectOptionDarkerDisabled']/div[@class='quantumWizMenuPaperselectOption'][@data-value='1.05pm - 3.55pm']").click()

The error I get is that no such element is found even though this is XPATH I have found from inspecting the dropdown menu accordingly.

This did not help as it uses the Select class How to select/get drop down option in Selenium 2

  • Welcome to SO. By any chance if you can share google form link also if its open for everyone ? Without it its hard to understand why its not working. – Sariq Shaikh Nov 25 '20 at 10:56
  • Thanks! I've made an example google form here: https://forms.gle/mer377omWUU51VhJ9 that have the same requirements i need – Isaac Marcus Lam Nov 26 '20 at 01:39
  • 1
    Why this was marked as close, its not simple selection box problem here ? – Sariq Shaikh Nov 26 '20 at 07:40
  • Anyway the problem is the selection box wont popup even if your xpath is correct until you hover on that element, hovering on that element makes it clickable. You can use below code to hover on that selection box element and than try to click and select `selectBox = WebDriverWait(browser, 30).until(EC.presence_of_element_located((By.XPATH, "//div[@role='listbox']"))) action = ActionChains(browser); action.move_to_element(selectBox).perform()` Unfortunately I can not post whole code here in comment – Sariq Shaikh Nov 26 '20 at 07:42
  • i think it seems too similar to another question even though i have specified that it doesn't use a simple select tag and is different. I've created a new question since with better phrasing that specifies this here: https://stackoverflow.com/questions/65015336/selecting-specifically-google-form-dropdown-using-selenium-without-select-tag-in – Isaac Marcus Lam Nov 26 '20 at 07:43

0 Answers0