UiPath文本操作Get OCR Text的介绍和使用
一、Get OCR Text操作的介绍
使用OCR屏幕抓取方法从指示的UI元素或图像中提取字符串及其信息。执行屏幕抓取操作时,还可以自动生成此活动以及容器。默认情况下,使用Google OCR引擎。
二、Get OCR Text在UiPath中的使用
1. 打开设计器,在设计库中新建一个Sequence,为序列命名及设置Sequence存放的路径,然后在Activities中搜索open browser,并将其拖至设计区,且设置打开网站,运行该流程“https://www.baidu.com/”
![](https://upload-images.jianshu.io/upload_images/14843435-b13a0b3eb05602dc.png?imageMogr2/auto-orient/strip|imageView2/2/w/327/format/webp)
![](https://upload-images.jianshu.io/upload_images/14843435-4b5f9d417f40dc52.png?imageMogr2/auto-orient/strip|imageView2/2/w/586/format/webp)
2. 在Activities中搜索 设置文本(set text),并将其拖至设计区,设置输入text为“uipath”,继续在Activities中搜索click,设置点击元素为“百度一下”,运行该流程
![](https://upload-images.jianshu.io/upload_images/14843435-fe51064c1f140358.png?imageMogr2/auto-orient/strip|imageView2/2/w/612/format/webp)
3. 在Activities中搜索 获取ocr文本(Get OCR Text),并将其拖至设计区,在属性区域设置输出变量为text
#拾取区域
![](https://upload-images.jianshu.io/upload_images/14843435-baeb4cc1568bbe24.png?imageMogr2/auto-orient/strip|imageView2/2/w/564/format/webp)
#设置变量text获取文本值
![](https://upload-images.jianshu.io/upload_images/14843435-09de78de4ce1a108.png?imageMogr2/auto-orient/strip|imageView2/2/w/452/format/webp)
![](https://upload-images.jianshu.io/upload_images/14843435-5b55b655ec7a28e8.png?imageMogr2/auto-orient/strip|imageView2/2/w/469/format/webp)
![](https://upload-images.jianshu.io/upload_images/14843435-798decacbdd4a77e.png?imageMogr2/auto-orient/strip|imageView2/2/w/508/format/webp)
4. 在Activities中搜索 log message,并将其拖至设计区,输入变量text,运行流程
![](https://upload-images.jianshu.io/upload_images/14843435-d507c80bb656e933.png?imageMogr2/auto-orient/strip|imageView2/2/w/508/format/webp)
#运行完成,你会看到日志窗口打印了从页面获取的文本信息
总结:以上流程就用到了获取ocr文本(Get OCR Text)的操作
UiPath交流群:465630324