1 Star 0 Fork 0

杨谦/基于seleninm的搭建

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
作业 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
杨谦 提交于 2021-10-28 11:56 . update 作业.
from selenium import webdriver
from selenium.webdriver.common.by import By
brower = webdriver.Chrome()
url = 'https://quote.eastmoney.com/center/gridlist.html#hs_a_board'
brower.get(url)
data = brower.find_elements(By.XPATH,'//tr[@class="odd"]/td[3] | //tr[@class="even"]/td[3]') #xpath的使用
data = brower.find_elements(By.XPATH,'//tr[@class="odd"]/td[9] | //tr[@class="even"]/td[9]')
# data = brower.find_elements(By.CSS_SELECTOR,'.odd') #css的使用
# data = brower.find_elements(By.CLASS_NAME,"mywidth")
for i in data:
print(i.text)
nextButton = brower.find_element(By.CSS_SELECTOR,".next.paginate_button")
nextButton.click()
# import requests
# import json
# url = 'https://90.push2.eastmoney.com/api/qt/clist/get?cb=jQuery1124005531437270239614_1634861401568&pn=1&pz=20&po=1&np=1&ut=bd1d9ddb04089700cf9c27f6f7426281&fltt=2&invt=2&fid=f3&fs=m:0+t:6,m:0+t:80,m:1+t:2,m:1+t:23&fields=f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f12,f13,f14,f15,f16,f17,f18,f20,f21,f23,f24,f25,f22,f11,f62,f128,f136,f115,f152&_=1634861401569'
# response = requests.get(url)
# # response.encoding = response.apparent_encoding
# print(response.status_code)
# data = response.text
# j= json.loads(data)
# for i in j['data']:
# for j in i['diff']:
# print(j['f14'])
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/qian-yang555/construction-based-on-seleninm.git
git@gitee.com:qian-yang555/construction-based-on-seleninm.git
qian-yang555
construction-based-on-seleninm
基于seleninm的搭建
master

搜索帮助