资源简介
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
相关资源
- 51Job.py
- python3网络爬虫与开发实战崔庆才PDF百
- python300G视频书籍教程.zip
- 5652华尔街见闻.py
- hulk.py
- 麦子学院Python视频.txt
- python核心基础.txt
- 仿真3D版本.py
- Python零基础10天进阶班.rar
- 用Python自动办公,做职场高手.txt
- 基于python实现的http接口自动化测试框
- spider_LOL.py
- Python教程.rar
- 小甲鱼零基础入门学习Python视频教程
- 麦子学院Python全套视频.txt
- 《疯狂Python讲义》习题答案.rar
- publishHelper.py
- sendInfo.py
- Python零基础10天进阶班.docx
- Python数据科学指南_Code.zip
- 爬取URP教务网站学籍信息.py
- Anaconda历史版本Python3.6版本.zip
- car_detected.py
- Python-图像分割Keras在Keras中实现Segne
评论
共有 条评论