Python自学记录--初级滑块,邮箱例子
from selenium import webdriverfrom time import sleep
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.common.by import By
from selenium.webdriver importActionChains
driver = webdriver.Chrome()
driver.get('https://mail.qq.com/')
sleep(0.4)
driver.switch_to.frame('login_frame')
driver.find_element_by_id('u').send_keys('785214563')
sleep(0.4)
driver.find_element_by_id('p').send_keys('1020300.0')
sleep(0.4)
WebDriverWait(driver,10).until(ec.element_to_be_clickable((By.ID,"login_button")))
driver.find_element_by_id('login_button').click()
sleep(1)
driver.switch_to.frame('tcaptcha_iframe')
sleep(0.4)
#拖动滑块
while True:
slider = WebDriverWait(driver,20).until(ec.element_to_be_clickable((By.ID,'tcaptcha_drag_thumb')))
distance = 175
actions = webdriver.ActionChains(driver)
#点击开始拖拽
actions.click_and_hold(slider)
actions.pause(0.2)
actions.move_by_offset(distance+5,0)
sleep(0.2)
actions.move_by_offset(-10, 0)
actions.release()
actions.perform()
sleep(2)
try:
shuaxin = WebDriverWait(driver,1).until(ec.presence_of_element_located((By.CLASS_NAME,"tcaptcha-embed-contrl show-reload")))
driver.find_element_class_name("tcaptcha-embed-contrl show-reload").click()
except:
driver.quit()
break 已测试,无法正常实现 就发个代码不如发到github上,发这至少说下哪个网站,测试图例吧? 欢迎分析讨论交流,吾爱破解论坛有你更精彩!
Teachers 发表于 2021-10-4 11:15
已测试,无法正常实现
我是成功了才发帖的 Joms 发表于 2021-10-4 13:22
就发个代码不如发到github上,发这至少说下哪个网站,测试图例吧?
呵呵呵呵呵呵😒 已测试 可以的{:1_921:} Teachers 发表于 2021-10-4 11:15
已测试,无法正常实现
哈哈哈哈哈哈哈哈哈,selenium失效是很快的,学习算法会长久一点 好白相,谢谢分享! 过滑块能干什么呀
页:
[1]