史诗级巨作 - 高级 RPA 培训录屏学习分享 - 源码贡献

温馨提示: 以下内容未获取艺赛旗中级认证证书者,慎重观看!(如有不适,还请见谅)

史诗级巨作 - 高级 RPA 培训录屏学习分享 - 源码贡献

源码案例来自于:艺赛旗高级课堂小作业 + 加循环翻页点击

内容解析:

1. 登录艺赛旗双录系统

2. 点击到产品页面

3. 查找页面列表上开头匹配 i-search-01 开头的 进行点击删除,然后点击取消

4. 当前页点击完毕,点击下一页,重复步骤 3,直到点击至最后一页,点击结束,关闭浏览器。流程结束

话不多说,直接上源码 (源码直接复制粘贴,是在你电脑上直接运行的哦)

复制粘贴后,一些缩进变化了,我把源码文件上传上来吧 ~

ea9801e81fa64c78869593e91115af43_.zip

ea9801e81fa64c78869593e91115af43_.zip

这个压缩包就是源码,解压后是个 txt 文本,直接复制粘贴里面的内容即可

import ubpa.iie as iie
import ubpa.ikeyboard as ikeyboard
import ubpa.iclipboard as iclipboard
import pandas as pd
import os
from time import sleep
import re
#网站
iie.open_url(ie_path=‘C:/Program Files (x86)/Internet Explorer/iexplore.exe’,url=“http://116.63.60.95:9080/login.action”)
time.sleep(1)
#窗口放大
ikeyboard.key_send_cs(waitfor=10.000,text=r’#{UP}‘)
time.sleep(1)
#鼠标点击
iie.do_click_pos(waitfor=10.000,run_mode=‘unctrl’,button=‘left’,curson=‘center’,continue_on_error=‘break’,search_mode=0,win_title=r’双录系统 - 录音、录像、录屏 - Internet Explorer’,selector=r’#loginWrap > UL:nth-of-type(1) > LI:nth-of-type(1) > INPUT:nth-of-type(1)‘,url=r’http://116.63.60.95:9080/login.action’)
#拷贝到剪贴板
iclipboard.set_clipboard(text=‘ceshi001’)
sleep(1)
#热键输入
ikeyboard.key_send_cs(waitfor=10.000,text=r’^v’)
time.sleep(1)
#鼠标点击
iie.do_click_pos(waitfor=10.000,run_mode=‘unctrl’,button=‘left’,curson=‘center’,continue_on_error=‘break’,search_mode=0,win_title=r’双录系统 - 录音、录像、录屏 - Internet Explorer’,selector=r’#loginWrap > UL:nth-of-type(1) > LI:nth-of-type(2) > INPUT:nth-of-type(1)‘,url=r’http://116.63.60.95:9080/login.action’)
time.sleep(1)
#模拟按键
ikeyboard.key_send_cs(waitfor=10.000,text=“typSVU”)
time.sleep(1)
#鼠标点击
iie.do_click_pos(waitfor=10.000,run_mode=‘unctrl’,button=‘left’,curson=‘center’,continue_on_error=‘break’,search_mode=0,win_title=r’双录系统 - 录音、录像、录屏 - Internet Explorer’,selector=r’#loginWrap > UL:nth-of-type(1) > LI:nth-of-type(2) > INPUT:nth-of-type(2)‘,url=r’http://116.63.60.95:9080/login.action’)
#鼠标点击
iie.do_click_pos(waitfor=10.000,run_mode=‘unctrl’,button=‘left’,curson=‘center’,continue_on_error=‘break’,search_mode=0,win_title=r’双录系统 - 录音、录像、录屏 - Internet Explorer’,selector=r’#popup_ok’,url=r’http://116.63.60.95:9080/login.action’)
time.sleep(1)
#鼠标点击
iie.do_click_pos(waitfor=10.000,run_mode=‘unctrl’,button=‘left’,curson=‘center’,continue_on_error=‘break’,search_mode=0,win_title=r’双录系统 - 录音、录像、录屏 - Internet Explorer’,selector=r’#frame-nav > UL:nth-of-type(1) > LI:nth-of-type(1) > A:nth-of-type(1)‘,url=r’http://116.63.60.95:9080/login.action’)
time.sleep(1)
#鼠标点击
iie.do_click_pos(waitfor=10.000,run_mode=‘unctrl’,button=‘left’,curson=‘center’,continue_on_error=‘break’,search_mode=0,win_title=r’双录系统 - 录音、录像、录屏 - Internet Explorer’,selector=r’#MenuContext > TABLE:nth-of-type(1) > TBODY:nth-of-type(1) > TR:nth-of-type(1) > TD:nth-of-type(2) > LI:nth-of-type(5) > A:nth-of-type(1)‘,url=r’http://116.63.60.95:9080/login.action’)
time.sleep(1)
#代码块

while 1:
is_next = False

#获取文本,看是否需要翻页
cur_page = iie.get_text(waitfor=10.000,selector=r'A[class="cur"]',title=r'理财管理',search_mode=0)
all_page = iie.get_text(waitfor=10.000,selector=r'#ListForm > DIV:nth-of-type(2) > DIV:nth-of-type(1) > DIV:nth-of-type(2) > FONT:nth-of-type(1) > DIV:nth-of-type(1)',title=r'理财管理',search_mode=0)


page_list = re.findall(r'[\d]+',all_page)


for page in page_list:
    print(page)
    if int(cur_page) < int(page):
        is_next = True
        break
        
# 处理当页数据
#拾取表格(web)

lv_1 = iie.get_ie_table(waitfor=10.000,selector=r'#boxTable',title=r'理财管理',continue_on_error='break',search_mode=0)



need_click_list = []
for tup in lv_1.itertuples():
    
    if str(tup[1]).startswith('i-Search-01'):
        need_click_list.append(tup[0]+2)
if need_click_list:
    for i in need_click_list:
        delete_path = r'#boxTable > TBODY:nth-of-type(1) > TR:nth-of-type({}) > TD:nth-of-type(8) > A:nth-of-type(2) > B:nth-of-type(1)'.format(i)
        iie.do_click_pos(waitfor=10.000, run_mode='unctrl', button='left', curson='center', continue_on_error='break',
                         search_mode=0, win_title=r'双录系统-录音、录像、录屏 - Internet Explorer',
                         selector=delete_path,title=r'理财管理')
        sleep(1)
        
        iie.do_click_pos(waitfor=10.000, run_mode='unctrl', button='left', curson='center', continue_on_error='break',
                         search_mode=0, win_title=r'双录系统-录音、录像、录屏 - Internet Explorer',
                         selector=r"#popup_cancel", title=r'理财管理')
        sleep(1)



# 判断是否翻页或结束
if is_next:
    # 翻页
    iie.do_click_pos(waitfor=10.000,run_mode='unctrl',button='left',curson='center',offsetX=20,offsetY=5,continue_on_error='break',search_mode=0,win_title=r'双录系统-录音、录像、录屏 - Internet Explorer',selector=r'#ListForm > DIV:nth-of-type(2) > DIV:nth-of-type(1) > DIV:nth-of-type(2) > FONT:nth-of-type(1) > DIV:nth-of-type(1) > SPAN:nth-of-type(3)',title=r'理财管理')

else:
    # 结束
    break

sleep(1)
ikeyboard.key_send_cs(waitfor=10.000,text=r’!{F4}’)

ps: 重点!!! 将代码原封不动拷贝到你的电脑上,打开艺赛旗设计器,使用代码块组件,复制粘贴就可以直接运行!如图所示:

第一步:

史诗级巨作 - 高级 RPA 培训录屏学习分享 - 源码贡献

第二步: 复制下方源代码

第三步:史诗级巨作 - 高级 RPA 培训录屏学习分享 - 源码贡献

最后就这样:

史诗级巨作 - 高级 RPA 培训录屏学习分享 - 源码贡献

按个 F5 就可以直接运行了,具体效果请君测验 ~