我想抓住一个房地产网站上市。它有一个aspx表格,必须在提交之前填写。Selenium无法找到元素(Python)WebScraping
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)
当我运行此脚本它提供了一个错误“无法找到元素‘ForSalePropertyType’我在做什么错在这里先谢谢
正式注意。感谢您的帮助。 –
请参阅http://stackoverflow.com/help/someone-answers。另外,看看你之前发布的问题是否有答案,应该被接受,比如这个,例如:http://stackoverflow.com/questions/32493807/selecting-specific-table-cells-in-硒的网络驱动程序蟒蛇。 – alecxe