Robocorp Beginners Tutorial - Getting Started with Robocorp RPA

Thomas Janssen | Tom's Tech Academy
14 Nov 202212:14

Summary

TLDR在这个视频中,Thomas 向我们展示了如何开始使用 Robocorp 来创建机器人。首先,他指导我们下载并安装 Python,然后是 Visual Studio Code (VS Code)。接下来,他介绍了如何安装 Robocorp 代码扩展和 Robot Framework 语言服务器扩展。在创建一个新的 Robocorp 项目后,Thomas 展示了如何使用 Robocorp 自动生成项目文件,并选择了标准 Robot Framework 模板。随后,他详细介绍了如何编写代码来构建一个简单的机器人,该机器人可以向 CRM 系统添加客户信息。他还展示了如何使用 Robocorp 的关键字来定义任务,并在任务中调用这些关键字。最后,他演示了如何运行机器人,并保持浏览器打开以查看结果。这个视频是一个很好的入门指南,适合那些想要快速开始使用 Robocorp 的人。

Takeaways

  • 🚀 **安装Python**:访问python.org下载并安装最新版本的Python,确保在安装过程中勾选了将Python添加到环境变量的选项。
  • 💻 **安装VS Code**:从code.visualstudio.com下载并安装Visual Studio Code(VS Code)。
  • 📚 **安装Robocorp扩展**:在VS Code中安装Robocorp Code和Robot Framework Language Server扩展。
  • 📁 **创建项目文件夹**:在文档中创建一个名为'robocorp projects'的文件夹来存储所有Robocorp项目。
  • ✅ **创建新项目**:在Robocorp Projects文件夹中创建一个名为'getting started with robocorp'的新文件夹,并在其中初始化项目。
  • 🔑 **选择项目模板**:选择Standard Robot Framework模板来创建项目,这个模板使用Robot Framework语言。
  • 🛠️ **编写代码**:在`tasks.robot`文件中编写机器人的代码,这是构建第一个机器人的起点。
  • 🌐 **使用RPA工具**:通过RPA Dash Unlimited网站了解将要构建的机器人,该机器人将添加客户到CRM系统中。
  • 📝 **定义关键字**:在Robot Framework中创建关键字(类似于其他编程语言中的函数),例如`open website`和`add customer to CRM system`。
  • 🔗 **定位元素**:使用浏览器的开发者工具来定位网页元素,并通过ID或类名来引用它们。
  • 🔑 **输入数据**:使用`input text`关键字为网页上的输入字段填充数据,如公司名称、联系人、地址、邮编、城市、国家、电话和电子邮件。
  • 🔖 **提交表单**:使用`submit form`关键字来提交表单,添加客户信息到CRM系统中。
  • 📑 **运行脚本**:在VS Code中运行脚本,观察Robocorp如何自动执行定义的任务,并将新客户添加到CRM系统中。

Q & A

  • 如何开始使用Robocorp?

    -首先需要下载并安装Python,然后下载并安装VS Code,接着从Robocorp官网下载并安装两个扩展:Robocorp Code和Robot Framework Language Server。之后创建一个新的Robocorp项目文件夹,并使用Robocorp自动生成项目文件。

  • 在安装Python时,为什么需要勾选'Add Python to PATH'?

    -勾选'Add Python to PATH'可以让Python在Windows的任何文件夹下都能被执行,否则只能在Python的安装目录下执行。

  • 为什么推荐安装Robot Framework Language Server扩展?

    -虽然这个扩展是可选的,但它可以提供更好的语法高亮、代码补全和错误提示等功能,从而提高开发效率。

  • 在VS Code中如何创建一个新的Robocorp项目?

    -可以通过按下Ctrl+Shift+P(或Mac上的Command+Shift+P),输入'create robot'并选择一个项目模板来创建。

  • 如何保持浏览器在Robocorp机器人运行后不关闭?

    -在设置中添加`Autoclose=False`,这样浏览器在机器人运行结束后不会立即关闭,方便查看结果。

  • 在Robocorp中,如何定义一个关键词(keyword)?

    -在项目的`tasks.robot`文件中,通过创建一个带有三个星号的section,并在其中定义关键词,关键词类似于其他编程语言中的函数。

  • 如何使用Robocorp打开一个网站?

    -可以使用Robocorp内置的`Open Available Browser`关键词,并提供网站的URL作为参数。

  • 在Robocorp中,如何向CRM系统添加客户信息?

    -通过定义一个名为`Add Customer to CRM System`的关键词,使用`Input Text`关键词填充表单中的各个字段,然后使用`Submit Form`关键词提交表单。

  • 如何获取网页中输入框的定位符(locator)?

    -可以通过在浏览器中右键点击输入框并选择'Inspect'来查看元素的HTML代码,从中找到元素的ID或其他属性作为定位符。

  • 在Robocorp中,如何引用已定义的关键词?

    -在`tasks`部分,使用自然语言描述任务,并在需要执行关键词的地方,使用`<keyword_name>`来引用已定义的关键词。

  • 如何运行Robocorp项目中的机器人?

    -在VS Code中,可以通过Robocorp Code扩展来运行机器人,它会打开浏览器,执行机器人,并且根据设置决定是否在执行结束后关闭浏览器。

  • 如果我想将这个视频推荐给其他人,应该怎么做?

    -如果觉得视频有用,可以给视频点赞(thumbs up),这有助于其他人发现这个视频,并且可以订阅发布视频的频道,以便观看后续的视频。

Outlines

00:00

🚀 开始使用Robocorp构建第一个机器人

本段主要介绍了如何开始使用Robocorp。首先,需要从python.org下载并安装最新版本的Python,并确保在安装过程中勾选了'Add Python to PATH'以便在任何文件夹中都能执行Python。接下来,从code.visualstudio.com下载并安装Visual Studio Code(VS Code)。之后,转到robocorp.com下载并安装两个扩展:Robocorp Code和Robot Framework Language Server。安装完成后,创建一个新的Robocorp项目文件夹,并使用Robocorp自动生成项目文件。最后,通过选择标准Robot Framework模板开始构建第一个机器人,并介绍了如何通过RPA-Dash网站获取示例机器人,该机器人用于将客户信息添加到CRM系统中。

05:02

🛠️ 定义关键词和任务

在Robocorp中,关键词类似于其他编程语言中的函数,可以被定义并在任务部分调用。首先,定义了'open website'关键词,使用Robocorp内置的'open available browser'关键词,并传入要打开的网址作为参数。接着,定义了'add customer to CRM system'关键词,涉及到多个步骤,包括输入公司名称、联系人、地址、邮编、城市、国家、电话和电子邮件。每个输入步骤都使用了'input text'关键词,并指定了相应的定位器和要输入的文本。此外,还介绍了如何通过'submit form'关键词提交表单。

10:03

📝 编写任务并运行脚本

在定义了关键词之后,需要在任务部分编写机器人的工作流程。首先,使用'open website'关键词打开CRM应用程序的网站。然后,使用'add customer to CRM system'关键词将客户信息添加到CRM系统中。在Robocorp中,任务部分允许用户以自然语言描述他们想要执行的操作,然后通过关键词来实现这些操作。最后,关闭浏览器并运行脚本,展示了如何通过Robocorp成功地将新客户添加到CRM系统中。如果设置了'Auto close'为false,则Robocorp在运行后不会立即关闭浏览器,这样用户可以看到机器人执行的结果。

Mindmap

Keywords

💡Robocorp

Robocorp是一个平台,用于开发、测试和部署机器人流程自动化(RPA)机器人。在视频中,Robocorp用于创建自动化任务,如向CRM系统添加客户信息。它提供了一套工具和库,使得自动化任务的编写和管理变得更加容易。

💡Python

Python是一种广泛使用的高级编程语言,以其清晰的语法和代码可读性而闻名。在视频中,Python被用来编写自动化脚本,因为Python具有强大的库支持,适合进行自动化任务的开发。

💡Visual Studio Code (VS Code)

VS Code是一个由微软开发的免费、开源的代码编辑器,支持多种编程语言。视频中提到下载并安装VS Code,因为它将作为编写和测试自动化脚本的主要开发环境。

💡扩展(Extensions)

在VS Code中,扩展是一种可以增强或添加新功能的插件。视频中提到安装了两个扩展:Robocorp Code和Robot Framework Language Server,这些扩展对于开发Robocorp机器人至关重要。

💡项目模板(Project Template)

项目模板是预先配置的文件和目录结构,可以作为新项目的起点。视频中使用了标准Robot Framework模板来快速开始一个新的Robocorp项目。

💡Robot Framework

Robot Framework是一个通用的自动化框架,用于接受关键的自动化需求并实现它们。它支持关键字驱动的测试,这使得非程序员也能编写自动化测试用例。视频中使用了Robot Framework语言来创建自动化任务。

💡关键字(Keywords)

在Robot Framework中,关键字是预先定义的函数,可以被其他任务调用。视频中创建了两个关键字:'open website'和'add customer to CRM system',用于执行特定的自动化任务。

💡任务(Tasks)

任务是Robot Framework中的一个概念,用于定义一系列的关键字执行顺序。视频中的任务部分说明了如何通过调用关键字来执行添加客户到CRM系统的操作。

💡设置(Settings)

在Robocorp项目中,设置用于配置机器人的行为,如导入库、定义变量等。视频中提到了在设置中添加'Auto close'为'${False}',以保持浏览器在执行完自动化任务后保持打开状态。

💡RPA(Robotic Process Automation)

RPA指的是使用软件机器人或人工智能来自动执行重复性的业务流程任务。视频中的示例是一个典型的RPA用例,即自动化地将客户信息添加到CRM系统中。

💡CRM系统

CRM系统,即客户关系管理系统,用于管理公司与现有客户以及潜在客户之间的关系。视频中的自动化任务是向CRM系统添加客户信息,展示了RPA在CRM系统中的实际应用。

Highlights

介绍了如何开始使用Robocorp,包括下载Python、VS Code,以及构建第一个机器人。

强调了从python.org下载最新版本的Python并启用'Add Python to PATH'的重要性。

展示了如何从code.visualstudio.com下载并安装VS Code。

推荐在VS Code中安装Robocorp Code和Robot Framework Language Server两个扩展。

说明了如何在文档中创建Robocorp项目文件夹并选择项目模板。

通过实例演示如何使用Robocorp构建一个添加客户到CRM系统的简单机器人。

解释了如何在VS Code中使用Robocorp创建关键词(functions)并编写任务(tasks)。

展示了如何使用Robocorp的内置关键词'open available browser'打开网站。

演示了如何通过检查元素来找到网页输入框的ID,并使用'input text'关键词填充数据。

介绍了如何使用'submit form'关键词来提交表单。

强调了在Robocorp设置中添加'Auto close=False'以保持浏览器打开状态查看结果的重要性。

展示了如何在任务(tasks)部分调用关键词,以及如何用自然语言描述任务。

解释了Robocorp机器人的三个主要部分:设置(settings)、任务(tasks)和关键词(keywords)。

演示了如何运行Robocorp脚本,并查看其在CRM系统中添加新客户的结果。

鼓励观众如果视频有帮助的话点赞,订阅频道,并期待下个视频。

整个视频是一个完整的Robocorp入门教程,从安装到构建简单的RPA机器人。

提供了一个实际的RPA用例,即如何自动化添加客户信息到CRM系统中。

强调了使用ID定位网页元素的准确性,因为ID应该是唯一的。

展示了如何通过Robocorp的自动化脚本快速且成功地完成任务。

Transcripts

play00:00

hey thank you so much for watching this

play00:02

complete video on how to get started

play00:03

with robocorp in this video we will

play00:06

download python we will download vs code

play00:08

and we will build as well our first bot

play00:10

with robocorp my name is Thomas and

play00:13

you're watching Tom stack Academy let's

play00:14

start right away

play00:16

and the first thing we have to do is

play00:18

installing python so navigate to

play00:20

python.org downloads and I'm going to

play00:22

click here on download python you see

play00:24

that currently the latest version is

play00:26

3.11 but it is very well possible that

play00:28

at the moment that you are downloading

play00:30

python there is already a new version

play00:31

just download the latest version and

play00:33

install it into your machine

play00:35

after the download has finalized click

play00:37

on the executable to start the

play00:39

installation process

play00:41

and there is one step that's very

play00:42

important and that's to enable at

play00:44

python.exit to pads because otherwise

play00:47

python cannot be executed from every

play00:49

folder within Windows just enable this

play00:51

checkbox and then click on install now

play00:55

after the installation was successful

play00:57

I'm going to close this window and we're

play00:59

going to continue with the installation

play01:00

of vs code navigate to

play01:03

code.facialstudio.com and then click

play01:04

here to download the latest version

play01:07

when the download has been finalized

play01:09

click on executable and follow the

play01:10

installation steps

play01:14

you can now launch Visual Studio code

play01:16

and click on finish

play01:19

and with the installation of vs code has

play01:21

been finalized you're going to navigate

play01:22

to robocorp.com download I'm going to

play01:26

download two extensions the first one is

play01:28

this one RoboCop codes just click on

play01:30

install from vs Marketplace and you will

play01:32

be redirected to vs code's own

play01:34

Marketplace

play01:36

clicking on install

play01:38

open Visual Studio code

play01:42

and can see the extension right here

play01:43

click on install again once you've

play01:46

installed this extension let's continue

play01:47

with the next one

play01:49

and that's this one the Robot Framework

play01:51

language server this one is optional but

play01:53

I highly recommend to download it as

play01:55

well

play01:56

click install open Visual Studio codes

play02:00

and start the installation once both

play02:03

extensions have been installed navigate

play02:04

to file

play02:06

click open folder and now we're going to

play02:08

determine where we want to save our

play02:09

robot and I'm going to do that in

play02:11

documents robocorp projects so this is a

play02:14

folder I created to store all my

play02:15

robocore projects and in that folder I'm

play02:18

going to create a new folder that I'm

play02:19

going to call

play02:22

getting started with robocorp

play02:28

select the folder and I click on select

play02:30

folder after the project has been

play02:32

created it's time to fill it up with

play02:34

files and roboclub can do that

play02:35

automatically for us just press Ctrl

play02:38

shift p or command shift p if you're

play02:40

using a Mac computer

play02:41

and then I'm going to type create robot

play02:45

like this press enter Then you can

play02:47

choose the project template that you

play02:49

would like to use for example you can

play02:50

use the basic python template and there

play02:52

is another video on my channel that

play02:54

explains how to set up a python project

play02:55

with robocorp for now I'm going to go

play02:58

for the standard Robot Framework

play02:59

template and this template uses the

play03:01

Robot Framework language so click on

play03:04

this one

play03:05

and then you can use the workspace

play03:07

folder that we are currently in so just

play03:09

press use workspace folder and now you

play03:11

see on the left side that the project

play03:13

has been created navigate to tasks.robot

play03:15

and that's where we're going to type our

play03:17

actual code

play03:18

now we are ready to start building a

play03:20

first robot and the robot that we're

play03:21

going to build is this one navigate to

play03:24

RPA Dash unlimited.com

play03:27

and scroll down and then click on

play03:29

navigate to YouTube example applications

play03:30

and course material

play03:32

now we're going to navigate to robocore

play03:34

built your first robot with robocorp so

play03:36

click on course material

play03:38

and the robot that we're going to build

play03:40

today is going to add customers to a CRM

play03:43

system so what we're going to do we're

play03:44

going to add customer information to

play03:46

those fields

play03:47

and now we're going to click on ADD

play03:49

transaction

play03:50

and that way this customer will appear

play03:52

in this form and we can then proceed

play03:54

with the next one so this is one of the

play03:56

most simple RPI use cases and it's a

play03:59

very good robot if you just want to make

play04:00

a quick start with robocorp so navigate

play04:03

back to vs code and how robocorp is set

play04:06

up of course you have the settings and

play04:08

in the settings I'm just gonna add a new

play04:10

line because I want to import the

play04:12

library and the library that I'm going

play04:15

to import press tab

play04:17

is RPA dot browser dot selenium this one

play04:22

and what's very important what RoboCop

play04:25

normally will do it opens the browser

play04:27

then it will run the robot and then

play04:29

it'll immediately close the browser and

play04:30

that's very inconvenient because you

play04:32

cannot see the result of your robot so

play04:34

if you want to avoid that just press tab

play04:36

here

play04:37

now we're going to add Auto underscore

play04:40

close is equal to dollar sign curly

play04:44

brackets false and that way we will keep

play04:46

the browser open after robocorp has been

play04:49

running so you can see the result of the

play04:51

robot then we have a section tasks and

play04:54

I'm just going to remove this text here

play04:56

I'm going to add a section

play04:58

and you add a section with three stars

play05:01

and I'm going to add the section

play05:03

keywords

play05:04

so how aerobical breaks we're going to

play05:06

create two keywords and then we're gonna

play05:08

call these keywords from the task

play05:10

section and these keywords are a bit

play05:12

like functions and other programming

play05:14

languages so here we declare functions

play05:15

and then in the test section we're going

play05:17

to call them so let's start with the

play05:19

first keywords so the first function and

play05:22

that one is really simple I'm just going

play05:23

to call it open website

play05:25

and it's going to open this website

play05:27

robco also has its own keywords and one

play05:30

of those keywords is open available

play05:32

browser so just start typing

play05:34

and you should see suggestions popping

play05:36

up like this and open available browser

play05:38

if you press tab you also see the

play05:40

arguments that it needs I see here that

play05:42

this keyword needs one arguments which

play05:43

is the URL and as of type string and I'm

play05:47

just going to provide this argument so

play05:49

just copy this URL

play05:52

space it here like this and then press

play05:54

enter

play05:55

press shift tap to go back to left side

play05:58

so you see how easy this was we've just

play06:00

created our first keyword let's proceed

play06:02

to the next one

play06:03

and that's add customer

play06:06

to CRM system

play06:09

so this is the name of the keyword

play06:12

this is also how we're going to refer to

play06:14

this keyword later

play06:15

then press tab and if we go back to your

play06:18

website see that there are a number of

play06:20

fields that we want to type and if I'm

play06:22

I'm just gonna start with typing the

play06:24

first one and the keyword that we're

play06:26

going to need is input space text

play06:30

and then press tab

play06:31

like this so it's very important that

play06:33

this is a space and this is a tab I see

play06:36

that this keyword input text needs two

play06:38

arguments the first one is the locator

play06:40

and the second one is the text that you

play06:42

want to type and the locator I'm going

play06:45

to click here on company name

play06:47

so just right click here on this input

play06:49

field

play06:49

and then click on inspect and you see

play06:52

the HTML code on the right side

play06:54

and then you see how this input element

play06:56

has been built up and if you focus on

play06:59

this input element and if you scroll

play07:01

here you also see that you scroll to the

play07:02

HTML elements if I click on this one

play07:05

then you see how this HTML element has

play07:07

been built up so you see if it is of

play07:09

type text it has class form control and

play07:12

it has ID company name and what I try to

play07:15

do most of the time is at the user ID

play07:17

you can also use a class but you will

play07:19

see that the class is not always unique

play07:21

so if you can choose I would always

play07:23

start with the ID because that should be

play07:25

unique in this case I'm going to copy

play07:27

this ID

play07:28

company Dash name and I'm going to paste

play07:30

it in vs code as a locator

play07:33

so the ID of the element is not a

play07:35

locator and the text that I want to type

play07:37

in this form so it is the company name

play07:39

so let's start with Toms

play07:42

Tech Academy

play07:45

press enter now we're going to proceed

play07:47

with the next input text input

play07:50

text

play07:52

tab

play07:54

and the next one click on inspect and

play07:57

you see here the ID is company Dash

play07:58

contact so just copy it

play08:01

base it here and I'm going to build a

play08:04

company contacts so I'm just going to

play08:06

type Thomas Johnson here

play08:09

now we're going to proceed with the next

play08:11

one input text

play08:14

tap

play08:15

and the third one that's the address and

play08:18

if you click here on inspect you can see

play08:19

that the ID is address here so you just

play08:22

copy that

play08:23

and my address is long

play08:27

313

play08:29

C to the fourth one one two three four

play08:33

and that's the zip code and you see here

play08:35

that ID is also zip code

play08:41

[Music]

play08:45

zip codes and my zip code is one two

play08:48

three four a b touch zip codes are a bit

play08:51

different than ZIP codes in the rest of

play08:53

the world they contain numbers and also

play08:56

letters

play08:58

input text

play09:02

and after the ZIP code we get the city

play09:06

and the locator should also be City so

play09:09

let's just double check that City

play09:13

City

play09:14

and my city is Mass Effect

play09:19

country inspects and you see the ID is

play09:22

country

play09:24

[Music]

play09:27

and free

play09:29

the Netherlands

play09:32

and then we still have telephone

play09:35

which has ID telephone and email which

play09:37

has ID email

play09:41

[Music]

play09:58

okay now there are a number of things

play10:00

that we can do to serpent this button

play10:03

uh we can click it physically but there

play10:04

is also another way and that's a very

play10:06

easy one

play10:07

that's just the keyword submit form and

play10:11

it doesn't have any arguments so just

play10:13

press enter and then we've also

play10:15

completed our second keyword so we have

play10:17

now two keywords we have open websites

play10:19

and we also have ADD customer to CRM

play10:23

system so those are the keywords that we

play10:24

have but if we execute the script they

play10:27

are not directly called because we still

play10:28

have to refer to them we're going to do

play10:30

that in the tasks section and we edit

play10:33

RoboCop works that you first dial Rubik

play10:35

of what you want to do just explain in

play10:37

the normal human language and then you

play10:39

refer to the keyword so I'm just gonna

play10:41

say

play10:43

open the website of the

play10:46

CRM application

play10:49

I'm going to press enter Tab and then

play10:51

I'm going to refer to the keyword and

play10:53

this is the keyword right so it's just

play10:55

open website

play10:57

and you should also see it in the

play10:59

suggestions here

play11:01

like this

play11:02

and then the second keyword that I'm

play11:04

gonna refer to so the second task that

play11:07

we execute is we're going to add a

play11:09

customer to the CRM system

play11:11

at One customer to the CRM system and

play11:16

the keyword that we're going to refer to

play11:18

is this one

play11:21

so just tap here Ctrl V

play11:24

so this is the anatomy of a robot in

play11:26

robocorp first you have settings you can

play11:28

include as many libraries as you want

play11:30

here then you have the tasks where you

play11:32

refer to the keywords and then you have

play11:34

the keywords here where you define what

play11:36

those keywords should do okay let's

play11:39

close our browser

play11:41

and run the script

play11:48

and if you didn't Define all to close

play11:50

this false here then RoboCop would not

play11:52

immediately close the browser so that's

play11:53

why this keyword is so useful

play11:56

I see that robocorp has just entered a

play11:58

new customer to my CRM system it was

play12:01

very fast and it was also successful

play12:03

I hope this video was useful for you if

play12:05

it was please give it a thumbs up and

play12:07

that will also help other people to find

play12:09

this video don't forget to subscribe to

play12:11

my channel and I hope to see you in the

play12:13

next video

Rate This

5.0 / 5 (0 votes)

Related Tags
RobocorpPythonVS CodeRPA教程自动化编程入门CRM系统Tom Stack视频教学
Do you need a summary in English?