我是 Python 3.X 的新手,需要编写一个脚本来自动化从 American Fact Finder 下载美国人口普查数据的过程。我正在使用 selenium webdriver,到目前为止我的代码是:
driver = webdriver.Chrome(chromePath)
#make driver navigate to American Fact Finder Download Center
driver.get('https://factfinder.census.gov/faces/nav/jsf/pages/download_center.xhtml')
#Make driver click 'Next' to go to Dataset page
driver.find_element_by_xpath('''//*[@id="nextButton"]''').click()
#this is where I need to locate the drop down and select American Community Survey'
在“数据集”页面上,我需要从下拉列表中选择“美国社区调查”,但无论我如何尝试找到运行脚本的下拉列表(xpath、id、值等)都会返回NoSuchElementException: no such element: Unable to locate element:
我需要帮助找到正确的元素并从下拉菜单中选择“美国社区调查”。
谢谢!