网络废弃Selenium隐藏的Javascript

时间:2017-04-02 10:35:44

标签: javascript python selenium web-scraping

我想把2016-03-01的年度财务报告从上海证券交易所上市公司的所有年度财务报告中删除。

http://www.sse.com.cn/disclosure/listedinfo/regular/

虽然搜索是隐藏的javascript,但我不确定如何输入日期。请帮忙。

from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.ui import Select
from selenium.webdriver.common.action_chains import ActionChains
import bs4
from bs4 import BeautifulSoup
import urllib.request

url = "http://www.sse.com.cn/disclosure/listedinfo/regular/"

chrome_path = r"/chromedriver.exe"
driver = webdriver.Chrome(chrome_path)
driver.get(url)

start_date = "2016-03-01"
end_date = "2017-02-28"
start = driver.find_element_by_id("start_date")
end = driver.find_element_by_id("end_date")
search = driver.find_element_by_id("btnQuery")

actions = ActionChains(driver)
actions.send_keys_to_element(start, start_date)      #can't send key
actions.send_keys_to_element(end, end_date)          #can't send key
actions.click(search)
actions.perform()

0 个答案:

没有答案