如何使用python selenium在qualtrics在线调查中找到该元素?

如何使用python selenium在qualtrics在线调查中找到该元素?,python,selenium,Python,Selenium,我正在做一个营销项目,我必须使用Qualtrics调查收集300多个回复。然而,我不能得到那么多的结果 因此,我尝试用selenium和python自动填充调查。但是我遇到了一个问题,我找不到元素 供参考:调查的链接: 它返回一个错误: selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector

我正在做一个营销项目,我必须使用Qualtrics调查收集300多个回复。然而,我不能得到那么多的结果

因此,我尝试用selenium和python自动填充调查。但是我遇到了一个问题,我找不到元素

供参考:调查的链接:

它返回一个错误:

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate 
element: {"method":"xpath","selector":"//*[@id="QR~QID2~1"]"}

我能知道怎么解决这个问题吗?非常感谢

试试下面的解决方案,这是一个同步化问题,您可以使用Webdriver wait来避免它

driver.get("https://hkbuhk.ca1.qualtrics.com/jfe/form/SV_cuvrHqLdEhcwTEV")
driver.maximize_window()

wait = WebDriverWait(driver, 10)

wait.until(EC.element_to_be_clickable((By.XPATH, "//input[@id='QR~QID2~1']"))).click()
注意:请将以下导入添加到您的解决方案中

from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait

请您回答,并从您这边点击向上投票按钮。我很想向上投票,但我的声誉不够高,无法这样做。“感谢您的反馈!声誉低于15的人所投的票将被记录,但不会更改公开显示的帖子分数。”
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait