0
我試圖自動執行此網站中的搜索過程:https://www.bcbsga.com/health-insurance/provider-directory/searchcriteria 該過程涉及單擊「繼續」按鈕以在「訪客」模式下進行搜索。下一頁獲得了用於優化搜索條件的下拉項目列表。我的代碼要麼產生「元素不可見」異常(我通過等待糾正)或超時。請幫忙。Python Selenium Webdriver選擇下拉值
這裏是我的代碼:
# navigate to the desired page
driver.get("https://www.bcbsga.com/health-insurance/provider-directory/searchcriteria")
# get the guest button
btnGuest = driver.find_element_by_id("btnGuestContinue")
#click the guest button
btnGuest.click()
wait = WebDriverWait(driver,10)
#Find a Doctor Search Criteria page
element = wait.until(EC.visibility_of_element_located((By.ID,"ctl00_MainContent_maincontent_PFPlanQuestionnaire_ddlQuestionnaireInsurance")))
lstGetInsurance = Select(element)
lstGetInsurance.select_by_value("BuyMyself$14States")
# close the browser window
#driver.quit()
感謝很多您的解決方案 - 它的作品!我想知道我以前的代碼有什麼問題。任何指針?我曾嘗試通過可見文本進行選擇。 – Srikanth
您使用的ID是'選擇'ID,但選擇存儲在'輸入'中。 – Anton