python滑动拼图_python爬虫--------处理极验验证(滑块拼图验证)bilibili模式

from selenium import webdriverfrom PIL import Imageimport timeimport randomfrom selenium.webdriver import ActionChainsimport cv2from matplotlib import pyplot as pltclass slide():#初始化def __init__(self)...
摘要由CSDN通过智能技术生成

from selenium import webdriver

from PIL import Image

import time

import random

from selenium.webdriver import ActionChains

import cv2

from matplotlib import pyplot as plt

class slide():

#初始化

def __init__(self):

self.driver = webdriver.Chrome(executable_path='..') #自己的驱动地址

self.driver.maximize_window()

self.trance =0

self.driver.get("https://passport.bilibili.com/login")

self.driver.find_element_by_id('login-username').send_keys('....')#用户名

self.driver.find_element_by_id('login-passwd').send_keys('....')#密码

self.driver.find_element_by_class_name('btn-login').click()

print('login..........')

time.sleep(3)

#有完整背景图的网页截图

def before_deal_image(self):

self.js1 = 'document.getElementsByClassName("geetest_canvas_fullbg")[0].style.display="block"' #获得

self.driver.execute_script(self.js1)

time.sleep(2)

self.location = self.driver.find_element_by_class_name('geetest_widget').location

self.size = self.driver.find_element_by_class_name('geetest_widget').size

time.sleep(2)

self.driver.save_screenshot('capture1.png') # 截取全屏

self.left = self.location['x'] + 220 # 后面的数字自己调节控制截图包含验证码图片

self.top = self.location['y'] + 57

self.right = self.location['x'] + self.size['width'] + 295

self.bottom = self.location['y'] &#

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值