commit
8eb8db6137
@ -0,0 +1,8 @@
|
|||||||
|
# 默认忽略的文件
|
||||||
|
/shelf/
|
||||||
|
/workspace.xml
|
||||||
|
# 基于编辑器的 HTTP 客户端请求
|
||||||
|
/httpRequests/
|
||||||
|
# Datasource local storage ignored files
|
||||||
|
/dataSources/
|
||||||
|
/dataSources.local.xml
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module type="PYTHON_MODULE" version="4">
|
||||||
|
<component name="NewModuleRootManager">
|
||||||
|
<content url="file://$MODULE_DIR$" />
|
||||||
|
<orderEntry type="jdk" jdkName="Python 3.10" jdkType="Python SDK" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
@ -0,0 +1,24 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<profile version="1.0">
|
||||||
|
<option name="myName" value="Project Default" />
|
||||||
|
<inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true">
|
||||||
|
<option name="myValues">
|
||||||
|
<value>
|
||||||
|
<list size="7">
|
||||||
|
<item index="0" class="java.lang.String" itemvalue="nobr" />
|
||||||
|
<item index="1" class="java.lang.String" itemvalue="noembed" />
|
||||||
|
<item index="2" class="java.lang.String" itemvalue="comment" />
|
||||||
|
<item index="3" class="java.lang.String" itemvalue="noscript" />
|
||||||
|
<item index="4" class="java.lang.String" itemvalue="embed" />
|
||||||
|
<item index="5" class="java.lang.String" itemvalue="script" />
|
||||||
|
<item index="6" class="java.lang.String" itemvalue="h1" />
|
||||||
|
</list>
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="myCustomValuesEnabled" value="true" />
|
||||||
|
</inspection_tool>
|
||||||
|
<inspection_tool class="PyTypeCheckerInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="PyUnboundLocalVariableInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
<inspection_tool class="PyUnreachableCodeInspection" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||||
|
</profile>
|
||||||
|
</component>
|
@ -0,0 +1,6 @@
|
|||||||
|
<component name="InspectionProjectProfileManager">
|
||||||
|
<settings>
|
||||||
|
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||||
|
<version value="1.0" />
|
||||||
|
</settings>
|
||||||
|
</component>
|
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10" project-jdk-type="Python SDK" />
|
||||||
|
</project>
|
@ -0,0 +1,8 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="ProjectModuleManager">
|
||||||
|
<modules>
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/.idea/cyan_horse.iml" filepath="$PROJECT_DIR$/.idea/cyan_horse.iml" />
|
||||||
|
</modules>
|
||||||
|
</component>
|
||||||
|
</project>
|
@ -0,0 +1,6 @@
|
|||||||
|
from DrissionPage import ChromiumPage
|
||||||
|
|
||||||
|
# 创建页面对象,并启动或接管浏览器
|
||||||
|
page = ChromiumPage()
|
||||||
|
# 跳转到登录页面
|
||||||
|
page.get('https://g1879.gitee.io/drissionpagedocs/get_start/examples/control_browser')
|
@ -0,0 +1,54 @@
|
|||||||
|
from DrissionPage import WebPage
|
||||||
|
from DrissionPage.common import *
|
||||||
|
import time
|
||||||
|
import json
|
||||||
|
# http://hnqmgc.17el.cn/grzx/
|
||||||
|
|
||||||
|
|
||||||
|
# 创建页面对象,并启动或接管浏览器
|
||||||
|
page = WebPage()
|
||||||
|
# 跳转到登录页面
|
||||||
|
page.get('http://hnqmgc.17el.cn/grzx/')
|
||||||
|
|
||||||
|
# 定位到账号文本框,获取文本框元素
|
||||||
|
ele = page.ele('#userName') # #的意思是通过id定位元素
|
||||||
|
# 输入对文本框输入账号
|
||||||
|
ele.input('51140220050507901X')
|
||||||
|
# 定位到密码文本框并输入密码
|
||||||
|
page.ele('#password').input('hnqm123456')
|
||||||
|
# 定位到验证码文本框并输入验证码
|
||||||
|
inpcode = page.ele('#yzcode').text # 湖南青马太可爱了吧,验证码居然直接放在页面源码里:)
|
||||||
|
page.ele('#inpcode').input(inpcode)
|
||||||
|
# 点击登录按钮
|
||||||
|
page.ele('#btnLogin').click()
|
||||||
|
# 进入课程页面
|
||||||
|
page.ele('.wxtsBox-button').click() # 关闭提示页面
|
||||||
|
page.ele('#login_btn').click()
|
||||||
|
page.ele('@value=进入个人中心').click()
|
||||||
|
# 提取课程信息
|
||||||
|
time.sleep(2)
|
||||||
|
page.ele('@value=0').click()
|
||||||
|
# 获取总页数
|
||||||
|
course_info = {}
|
||||||
|
# <div class="paginationjs-nav J-paginationjs-nav">1 / 4</div>
|
||||||
|
total_page = int(page.ele('.paginationjs-nav J-paginationjs-nav').text[-1])
|
||||||
|
for i in range(total_page):
|
||||||
|
# 逐页读取课程信息和完成状态并存放到字典中
|
||||||
|
tbodys = page.ele('#tbody')
|
||||||
|
# 获取tbody下的所有tr
|
||||||
|
trs = tbodys.eles('tag:tr')
|
||||||
|
for tr in trs:
|
||||||
|
cur_info = tr.text.split('\t')
|
||||||
|
print(cur_info)
|
||||||
|
course_id = cur_info[0] # 课程id
|
||||||
|
course_rate = cur_info[3] # 课程完成百分比
|
||||||
|
course_status = cur_info[4] # 课程完成状态(是否完成习题/评价)
|
||||||
|
# 存放到字典中
|
||||||
|
course_info[course_id] = {'rate': course_rate, 'status': course_status}
|
||||||
|
if i != total_page - 1:
|
||||||
|
page.ele('@type=text').input(i + 2)
|
||||||
|
page.ele('@value=跳转').click()
|
||||||
|
time.sleep(1)
|
||||||
|
print(len(course_info))
|
||||||
|
page.close_session()
|
||||||
|
|
Loading…
Reference in new issue