python 获取东方财富网站的数据
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import pandas as pd
from selenium import webdriver
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.common.action_chains import ActionChains
from datetime import datetime
import time
def get_data(url):
browser = webdriver.Chrome()
WebDriverWait(browser, 10)
browser.get(url)
WebDriverWait(browser, 5, 0.5).until(EC.presence_of_element_located((By.ID, 'sidemenu')))
above = browser.find_element_by_css_selector(
"#sidemenu > div > div.level-list > ul > li.sub-items.menu-hsindex-wrapper")
ActionChains(browser).move_to_element(above).perform()
lis =