当前位置:网站首页>Selenium batch query athletes' technical grades
Selenium batch query athletes' technical grades
2022-06-23 21:36:00 【XerCis】
List of articles
Problem description
2022 Xi'an mouning 3V3 Men's singles A Group How many volumes are there ?

install
- Python Of
seleniumlibrary
pip install selenium
- install Chrome
- View this machine Chrome Version number

- install Chrome drive
Search according to the version number Google browser drive image or The official driver
After decompressingchromedriver.exePut it inC:\Users\Administrator\AppData\Local\Programs\Python\Python36in
Test code
from selenium import webdriver
driver = webdriver.Chrome()
driver.get('https://www.baidu.com/')
Code
OCR Use wechat to extract text or QQ Screen map of , Here slightly .
Selenium + Athlete technical grade information inquiry system
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
user_names = [' Wang Jingqi ', ' Duanyuanlong ', ' Jiang Yu ', ' Liujiaxin ', ' Li Yichen ', ' Qiaojiahui ', ' Zhouhuiyi ', ' Tangtianyi ', ' Qin Yuyang ', ' Guo Ke ', ' Fudixiong ', ' Wangxinluo ', ' Zhangmiaohan ', ' Zhang Jingchao ', ' Zhu enliang ',
' Fanzeyang ', ' Gaojiawei ', ' Yujilin ', ' Yang Bo ', ' Maolikai ', ' He Feifan ', ' Li Penghui ', ' Liu Junyan ', ' Zhangyuehan ', ' Wang Jiahua ', ' Dang Chujing ', ' Li Haojie ', ' Bai Chenyang ', ' Guorongyi ', ' Wanxinhao ',
' Sun Yang ', ' Chang Haokun ', ' Zhao Liang ', ' Baiweizhao ', ' Xie Shaoshi ', ' Liu Xin ', ' Fanglonghao ', ' Wang Weichu ', ' Gengzhihao ', ' Liulinghua ', ' Wuruilong ', ' Xu Lei ', ' Caoxianlong ', ' Lvtongpu ', ' Suwusong ',
' Zhuzixi ', ' Li Chengmin ', ' Songzhenting ', ' Lilongyue ', ' Fanson ', ' Liuzhiyu ', ' Zhaoshiteng ', ' Yang Ye ', ' Wangyilun ', ' Wangzichen ', ' Ganshijie ', ' Zhangtingquan ', ' Liuguoyang ', ' Zhang Yiwei ', ' Zhang Jiahao ',
' Cui Peng ', ' Li Long ', ' Chaitao ', ' Bai Jinhao ', ' Liangzhiwen ', ' Jiaoziyi ', ' Mutong ', ' Yangzeyu ', ' Wang Lu ', ' Lei Yu ', ' Zhangzheheng ', ' Wangkaihong ', ' Zhang Xin ', ' Fu Lei ', ' Yi-ming liu ', ' Wangyashuai ',
' Liangjianwei ', ' Su Ming ', ' Li Jiaxuan ', ' Xuzihao ', ' Wang Huanjun ', ' Baichengzhao ', ' Zhang Xiao ', ' Huxiaobin ', ' Yang Hailin ', ' Chenzhengang ', ' Dengqinlong ', ' LV Libao ', ' Lvjinbo ', ' Easy ', ' Li Yao ',
' Liu Tengfei ', ' Sunqixuan ', ' Liuwenze ', ' Zhangbolong ', ' Wang Zhe ', ' Liguojing ', ' Gao Wei ']
# Chrome To configure
option = webdriver.ChromeOptions()
option.add_experimental_option('useAutomationExtension', False)
option.add_experimental_option('excludeSwitches', ['enable-automation'])
driver = webdriver.Chrome(options=option)
# Crawling logic
count = 0
for user_name in user_names:
driver.get(f'https://ydydj.univsport.com/index.php?c=look&a=seach_look&item=36.1&user_name={
user_name}')
# Explicit waiting 5s, lookup class by main_lista The elements of
main_lista = WebDriverWait(driver, 5).until(lambda x: x.find_element(By.CLASS_NAME, 'main_lista'))
elements = main_lista.find_elements(By.XPATH, './*') # Find all the elements below
if elements:
count += 1
for element in elements:
# Abridged edition
# text = element.text
# level = text.splitlines()[-1]
# print(user_name, level)
# A detailed version
element.click()
time.sleep(2)
wza_rigys = driver.find_element(By.CLASS_NAME, 'wza_rigys')
texts = wza_rigys.text.splitlines()
data = {
x.replace(':', ''): texts[i + 1] for i, x in enumerate(texts) if ':' in x} # Specific level information
print(data[' full name '], data[' Grade '], data[' The name of the game '], data[' score '], data[' Time of grant '])
else:
print(user_name)
print(f' Competition {
len(user_names)} people , Among them, level athletes {
count} people , Proportion {
count / len(user_names) * 100:.2f}%')
driver.close()
Competition 98 people , Among them, level athletes 21 people , Proportion 21.43%

PS: There may be people with the same name , For example, Sun Yang
reference
边栏推荐
- Full text search of MySQL
- 数字电路概述
- [tutorial] Tencent lightweight cloud builds an online customer service chat system
- Tencent cloud commercial password compliance solution appears at the 2021 high-end Seminar on commercial password application innovation
- 网上证券开户安全还是去营业部安全
- 实验五 模块、包和库
- SAP Migo mobile type 311 attempts to determine the batch, and the system reports an error -batch determination not Po
- Elegant asynchronous programming version answer async and await parsing
- It's very interesting. Make an app to decorate the Christmas hat on Christmas!
- I'm in Shenzhen. Where can I open an account? Is online account opening safe?
猜你喜欢

Facing the problem of lock waiting, how to realize the second level positioning and analysis of data warehouse

How does PMO select and train project managers?

Selenium批量查询运动员技术等级

How PMO uses two dimensions for performance appraisal
![Harmonyos application development -- mynotepad[memo][api v6] based on textfield and image pseudo rich text](/img/b1/71cc36c45102bdb9c06e099eb42267.jpg)
Harmonyos application development -- mynotepad[memo][api v6] based on textfield and image pseudo rich text

蓝牙芯片|瑞萨和TI推出新蓝牙芯片,试试伦茨科技ST17H65蓝牙BLE5.2芯片

New SQL syntax quick manual!

Gradle asked seven times. You should know that~

Find My资讯|苹果可能会推出第二代AirTag,试试伦茨科技Find My方案

Uncover the secrets of Huawei cloud enterprise redis issue 16: acid'true' transactions beyond open source redis
随机推荐
Beitong G3 game console unpacking experience. It turns out that mobile game experts have achieved this
How to create cloud disk service how to create cloud disk service backup?
Spend small money to do big things: cloud function + cloud development leverages the practice of e-commerce promoting flexible architecture in CCTV evening party
[development skills] how to add "live broadcast" status display bar on easynvr platform
Open source C # WPF control library ---newbeecoder UI drop down box
Talk about how to customize data desensitization
Prometheus primary body test
How to reduce snapshots
Is it safe to open an online securities account or to go to the business department
上线项目之局域网上线软件使用-----phpStudy
Customize view to imitate today's headlines and like animation!
How does PMO select and train project managers?
[redis] intersection and union of ordered sets
RI Gai series: push of STD container_ Why is back slower than []
[typescript] some summaries in actual combat
What software is safe to use to fight new debts? What are the new bond platforms
Game security - call analysis - write code
Global and Chinese market of American football catch gloves 2022-2028: Research Report on technology, participants, trends, market size and share
我在深圳,到哪里开户比较好?在线开户安全么?
Elegant asynchronous programming version answer async and await parsing