[英]How can I use Python to download Qualtrics Survey responses via the Qualtrics API
[英]How can I find the element in qualtrics online survey with python selenium?
我正在开展一个营销项目,我必须使用 Qualtrics 调查收集 300 多个回复。 但是,我无法获得那么多结果。
因此,我正在尝试使用 selenium 和 python 自动填充调查。 但是我遇到了找不到元素的问题。
仅供参考:调查链接: https://hkbuhk.ca1.qualtrics.com/jfe/form/SV_cuvrHqLdEhcwTEV
from selenium import webdriver
driver = webdriver.Chrome('/usr/local/bin/chromedriver')
driver.get('https://hkbuhk.ca1.qualtrics.com/jfe/form/SV_cuvrHqLdEhcwTEV')
driver.find_element_by_xpath("//*[@id="QR~QID2~1"]").click()
它返回一个错误:
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate
element: {"method":"xpath","selector":"//*[@id="QR~QID2~1"]"}
我可以知道如何解决这个问题吗? 非常感谢!
试试下面的解决方案,它是一个同步问题,你可以使用 Webdriver 等待来避免它。
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.