selenium 拖动下方滑块完成拼图

今天遇到一个刷新 可以重发短信验证码的,不过要图块拖拽(同样的位置,不用多加判断函数了),没有其他的验证,selenium拖拽可稍微绕过(成本稍高)

构成了短信轰炸

参考:

https://blog.csdn.net/u012067766/article/details/79793264   重点观看
https://www.cnblogs.com/Snail-offort/p/8761630.html
https://www.cnblogs.com/minieye/p/5803640.html
https://blog.csdn.net/snail5321/article/details/80797775
https://www.cnblogs.com/BigFishFly/p/6337153.html
#coding=utf-8
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import time
from selenium import webdriver
import selenium.webdriver.support.ui as ui
from selenium.webdriver.support import wait
from selenium.webdriver.common.keys import Keys
#引入ActionChains鼠标操作类
from selenium.webdriver.common.action_chains import ActionChains
start_url=""
driver=webdriver.Chrome(executable_path="D:/selenium/chrome/chromedriver.exe")
wait=ui.WebDriverWait(driver,20)
driver.get(start_url)
driver.find_element_by_id('username').send_keys('admin123321') # 输入用户名
driver.find_element_by_id('password').send_keys('admin123321!@#') # 输入密码
driver.find_element_by_id('tel').send_keys('15467891234') #输入手机号
#driver.find_element_by_link_text('获取验证码').click() # 点击获取验证码
#driver.find_element_by_class_name('getMessage usable').click()
ActionChains(driver).click(wait.until(lambda x: x.find_element_by_css_selector("#main-wrap > div > div.register-content > div.message > span"))).perform()
#
iframe = wait.until((lambda driver:driver.find_element_by_id('tcaptcha_popup')))
driver.switch_to.frame(iframe)
#
button = wait.until((lambda driver:driver.find_element_by_id('tcaptcha_drag_thumb')))
action = ActionChains(driver) # 实例化一个action对象
action.drag_and_drop_by_offset(button, 230, 0).perform()
action.move_to_element(button).release()

2019.3.31


发表评论

电子邮件地址不会被公开。 必填项已用*标注