from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
d = webdriver.Chrome()
d.get("http://databank.worldbank.org/data/embed-int/Table-1-SDDS-new/id/4f2f0c86")
dropdown = WebDriverWait(d,10).until(EC.visibility_of_element_located((By.CSS_SELECTOR, ".chosen-single")))
dropdown.click()
input = d.find_element_by_css_selector('.chosen-search input')
input.send_keys('Brazil')
input.send_keys(Keys.RETURN)
你最好使用硒这种方法。在这种情况下,您可以单击下拉列表并使用输入框发送您感兴趣的国家,然后输入。你知道吗
我也不知道如何从下拉菜单中选择选项,但这里是worldbank api
相关问题 更多 >
编程相关推荐