资源简介
shuake.py
代码片段和文件信息
#coding:utf-8
from selenium import webdriver
from selenium.webdriver import ActionChains
from selenium.webdriver.common.by import By #按照什么方式查找,By.IDBy.CSS_SELECTOR
from selenium.webdriver.common.keys import Keys #键盘按键操作
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait #等待页面加载某些元素
import re
import time
import sys
reload(sys)
sys.setdefaultencoding(‘utf8‘)
user=‘‘
passwd=‘‘
driver = webdriver.Chrome()
def isElementExist():
flag=True
try:
driver.find_element_by_class_name(‘popboxes_close‘)
return flag
except:
flag=False
return flag
def answer():
try:
select=WebDriverWait(driver10).until(
EC.frame_to_be_available_and_switch_to_it((By.ID “tmDialog_iframe“))
)
driver.find_element_by_css_selector(“input[_correctanswer=‘1‘]“).click()
driver.switch_to_default_content()
time.sleep(1)
p2 = WebDriverWait(driver 10).until(
EC.element_to_be_clickable((By.CLASS_NAME “popboxes_close“))
)
p2.click()
print “成功关闭弹窗.........“
except:
print(‘出现错误,请重启脚本‘)
def video_check():
res = driver.find_element_by_css_selector(“[class=‘progressbar_box_tip‘]“)
r = res.get_attribute(‘innerHTML‘)
t = re.findall(r‘([0-9].*?)%‘r)[0]
print “本节视频累计观看进度:{}%“.format(t)
if t == ‘100‘:
try:
next_page = WebDriverWait(driver10).until(
EC.element_to_be_clickable((By.CSS_SELECTOR “body > div.study_page > div.main_left > div > div.next_lesson > div > a“))
)
next_page.click()
time.sleep(3)
driver.execute_script(“document.getElementsByClassName(‘volumeIcon‘)[0].click();“)
driver.execute_script(“document.getElementsByClassName(‘volumeIcon‘)[0].click();“)
print(‘进入下一节的学习......‘)
except:
print “进入失败“
def start_player():
time.sleep(5)
if driver.find_element_by_css_selector(“[class=‘speedPromote_btn fr‘]“).get_attribute(‘outerHTML‘)!=‘‘:
driver.find_element_by_css_sele
相关资源
- python+ selenium教程
- 英文原版-Scientific Computing with Python
- CpuMemSets在Linux操作系统中的实现
- Python学习全系列教程永久可用
- 蓝奏云批量上传工具.zip
- python书籍 PDF
- 老男孩python项目实战
- Python.rar99111
- decision_tree_v2.py
- Python绝技运用Python成为顶级黑客.pdf
- python小波包文档及论文.zip
- Python黑帽子(黑客与渗透测试编程之
- FlaskWeb开发:基于Python的Web应用开发实
- Python基础教程第3版中英文源码.rar
- python数据结构与算法中文版.zip
- Python-冲顶大会芝士超人西瓜视频头脑
- time_series_forecasting_with_python.zip
- Python基础教程第三版PDF高清可复制.
- python编程从入门到实践.zip237878
- FlaskWeb开发:Python基于Web应用开发实战
- pythonBCRMDSJ.mobi
- 量化交易之路用Python做股票量化分析
- PYTHON自然语言处理中文版.pdf
- Python基础教程(第3版).rar
- GRAYHATPYTHON高清.英文.书签版.pdf
- Python简明教程第四版.rar
- Python编程:从入门到实践带书签完整
- Python基础教程(第3版).pdf109608
- vamei-从Python开始学编程.pdf
- 利用Python进行数据分析.pdf
评论
共有 条评论