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,'账号','密码',9004) 
dim list_temp = Split(sVerifyCode,"|")  //根据“|”拆分字符串,存储为临时列表 
//获取图片在屏幕坐标 
dim
 objRect = 
UiElement.GetRect({"html":{"tagName":"img","attrMap":{"css-selector":"body>div>div>div>div>div>form>div>div>div>div>div>div>div>img"},"index":0},"wnd":[{"app":"chrome","cls":"Chrome_WidgetWin_1","title":"*"},{"cls":"Chrome_RenderWidgetHostHWND","title":"Chrome
 Legacy 
Window"}]},"screen",{"bContinueOnError":false,"iDelayAfter":300,"iDelayBefore":200}) 
For i = 0 To Len(list_temp)-1 step 1    
// 获取文字坐标加上屏幕坐标    
x = CInt(Split(list_temp[i],",")[0]) + CInt(objRect['x'])    
y = CInt(Split(list_temp[i],",")[1]) + CInt(objRect['y'])    
//移动鼠标模拟点击    
Mouse.Move(x, y, false,{"iDelayAfter": 300, "iDelayBefore": 200})    
Delay(1000)   
Mouse.Click("left", "click", [],{"iDelayAfter": 300, "iDelayBefore": 300}) 
Next


//把附件放 在项目目录下 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
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值