我正试图抓住一个房地产网站上市.它有一个aspx表单,必须在提交之前填写.
http://www.cbre.us/PropertyListings/Pages/Properties-for-Sale.aspx
然而,我所关心的只是俄勒冈州的多户住宅物业.所以这是我的第一次尝试:
driver = webdriver.Firefox()
driver.get("http://www.cbre.us/PropertyListings/Pages/Properties-for-Sale.aspx")
#Searching for multifamily residences
selectPropertyType = driver.find_element_by_id("ForSalePropertyType")
selectPropertyType.select_by_value("70")
#In the state of Oregon
selectState = driver.find_element_by_id("ForSaleState_ListBox1")
selectState.select_by_value("OR")
#Submit form
submitBtn = driver.find_element_by_id("ForSaleLooplinkSubmit")
submitBtn.click()
#Wait for results to load
WebDriverWait(driver, 5)
Run Code Online (Sandbox Code Playgroud)
当我运行这个脚本时,它会给出一个错误"找不到元素"ForSalePropertyType".我在这里做错了什么?提前谢谢.