UiBot 验证拼图滑块验证码

该文描述了如何利用UibotRPA工具进行网站登录时的滑块验证码验证。首先,通过屏幕捕获获取验证码图片,然后利用超级鹰服务解析验证码。接着,获取滑块元素的位置并计算拖动起点,最后模拟鼠标拖动完成验证。代码中涉及到了图像处理、网页元素定位和事件模拟等技术。
摘要由CSDN通过智能技术生成

使用uibot RPA技术实现网站登录滑块验证码验证 

dim sImagePath = @res"Data\\sVerifyCode.jpg"
dim ImgEle = {"html":{"tagName":"div","attrMap":{"css-selector":"body>div>div>div>div>div>form>div>div>div>div"},"index":2},"wnd":[{"app":"chrome","cls":"Chrome_WidgetWin_1","title":"*"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}]}
UiElement.ScreenCapture(sImagePath,ImgEle,{"x":0,"y":0,"width":0,"height":0},{"bContinueOnError":false,"iDelayAfter":300,"iDelayBefore":200})
//请求超级鹰 
sVerifyCode = GetVerificationCode(sImagePath,'用户名','用户密码',9101) 
Log.Info(sVerifyCode)
//滑块在页面上的坐标
dim objRect = UiElement.GetRect({"html":{"tagName":"div","attrMap":{"css-selector":"body>div>div>div>div>div>form>div>div>div>div>div>div>div>div"},"index":2},"wnd":[{"app":"chrome","cls":"Chrome_WidgetWin_1","title":"*"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome Legacy Window"}]},"screen",{"bContinueOnError":false,"iDelayAfter":300,"iDelayBefore":200})
Log.Info(objRect)
//技术拼图凹槽位置  (这里这个30是拼图与滑块的边距 可根据自己边调试)
x = (CInt(objRect['x']) - 30) + CInt(Split(sVerifyCode,",")[0])
Log.Info(x)
//模拟拖动
Mouse.Drag(CInt(objRect['x']), objRect['y'], x, objRect['y'], "left", [],{"iDelayAfter": 300, "iDelayBefore": 200})

//把附件放 在项目目录下 C:\项目名\extend\python  
//在写个函数调用
Function GetVerificationCode(sImagePath,sChaoJiYingAccount,sChaoJiYingPassword,id)
Dim sVerificationCode = ""
Dim arrayVerificationCodeInfo = []
Try 3
id = cint(id)
//Log.Info("登录信息"&sChaoJiYingAccount&","&sChaoJiYingPassword&","&id&","&sImagePath)
arrayVerificationCodeInfo = chaojiying_utils.getCode(sChaoJiYingAccount,sChaoJiYingPassword,id,sImagePath)
Catch chaojiyingEx
Log.Info(chaojiyingEx)
Throw chaojiyingEx
End Try
sVerificationCode = arrayVerificationCodeInfo[1]
Return sVerificationCode

End Function

注意:使用的外部工具超级鹰

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值