[英]How to scrape drop-down menu options using Selenium Webdriver with Python?
[英]How to get all options from ul li drop-down using Selenium Webdriver with Python?
它應該是
browser.find_element_by_css_selector('#Filter_ClientDistrict button.dropdown-toggle').click()
WebDriverWait(browser, 5).until(EC.presence_of_element_located((By.CSS_SELECTOR, "#Filter_ClientDistrict ul li"))
myList = []
el = browser.find_element_by_id('Filter_ClientDistrict')
for option in el.find_elements_by_css_selector('ul li'):
myList.append(option.get_attribute("innerText").strip())
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.