1

I'm trying to automate filling out a Microsoft form and I am running into a problem that I'm having a hard time diagnosing. I have succeeded in using Selenium for accessing the form, but when I try to click the radio buttons using the xPath, Selenium fails to get find the radio buttons. I'm getting the xPath directly from the form website so I know its right. The other thing that's throwing me off is the @chrome appearing in the stack trace. As seen from my imports I'm using Firefox/Gecko not Chrome, so why is stack trace sound like Chrome is throwing the error. Last bit of info I noticed is that when I used the debug console to look inside the element, I notice that accessible_name, aria_role, shadow_root have trace back errors saved instead of values, but I'm not sure if it's related.

my code

from selenium.webdriver import Firefox
from selenium.webdriver.firefox.service import Service as FirefoxService
from webdriver_manager.firefox import GeckoDriverManager
from selenium.webdriver import FirefoxOptions
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

#stuff that I'm excluding, but works

WebDriverWait(driver,short_sleep).until(EC.presence_of_element_located((By.XPATH,FORM_QUESTION_ONE_XPATH)))
RadioButtonPeriod = driver.find_element(by=By.XPATH, value=FORM_QUESTION_ONE_XPATH)
RadioButtonPeriod.click()

error output:

selenium.common.exceptions.TimeoutException: Message:
Stacktrace:
WebDriverError@chrome://remote/content/shared/webdriver/Errors.jsm:183:5
NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.jsm:395:5
element.find/</<@chrome://remote/content/marionette/element.js:300:16
CSstudent
  • 669
  • 2
  • 7
  • 27
  • We will not be able to help here until you share a link to the page you are trying to work on and all your actual code – Prophet Feb 22 '22 at 11:59
  • replace by=By.XPATH, value=FORM_QUESTION_ONE_XPATH with By.XPATH, FORM_QUESTION_ONE_XPATH –  Feb 22 '22 at 12:23
  • Your Webdriver wait times out, so the element your waiting for doesnt exists or your timeout is to low. Try to set short_sleep to 15. If it still throws the error, you made something with your XPATH wrong or the element is in invisible Frame –  Feb 22 '22 at 12:24

0 Answers0