Responsive Menu
Let's Talk! +1 (646) 216-7541

How to build a web automation using OpenBots Studio

00:00:00

Hi, my name is Brian Torres and I’m your studio evangelist.

00:00:04

In today’s video, I’m going to be showing you how to do a web automation build using OpenBots Studio.

00:00:08

In this particular build, I’m going to be opening the Google search site using Chrome browser.

00:00:19

Afterwards, I’ll perform a very basic search for the current Google stock price.

00:00:23

Once you navigate to the page, I’m simply going to extract the current price listed there and display it in this show the in-message box to be able to confirm that we extracted the price.

00:00:33

In this video I’m also going to briefly discuss the two different types of commands that we have available for performing web automations and discuss the differences between them.

00:00:40

So let’s go ahead and get started.

00:00:42

In OpenBots Studio, we have two different versions of the same commands that you can utilize in order to build your web automations.

00:00:48

The first group are known as just learning base commands.

00:00:51

These will initialize your instance of the browser using selenium.

00:00:53

However, we also have a different subset that uses the same functionality but will initialize your browser the same way that a user would.

00:01:01

Now these commands are known as the Native browser commands because they utilize an extension to interact with the browser in the same way that a user would.

00:01:08

Now both versions will allow you to perform the same basic functionality for extracting or navigating through different webpages.

00:01:14

The main difference is going to be that selenium, because of the way it interacts with the web browser, will not give you access to any cache or cookies that you may already have in your browser, whereas the native ones will, as again they will interact the same way that the user would.

00:01:26

Would now the important thing to take away here.

00:01:29

Is that when using the native browser commands, you must have the correct extension installed depending on the browser you plan to utilize.

00:01:36

Let me show you how to go ahead and install the extensions you need in order to use the native browser commands.

00:01:41

From OpenBots Studio, you can see here, in the options tab, if you select this, you’ll see that we have the extensions manager available.

00:01:47

By selecting this, you’ll get a sub window that will have the different extensions currently available.

00:01:51

One dependent for each of the different browsers that we currently support.

00:01:54

These include Chrome, edge and Firefox.

00:01:58

Simply click on the install button located next to the extension that you wish to install and OpenBots Studio will automatically install the extension for you.

00:02:05

Just make sure to open the browser afterwards. Navigate to the extensions page and ensure that it has been enabled.

00:02:10

Once you’ve done so, you’re ready to utilize all of our native browser-based commands.

00:02:15

Now with that distribution out of the way, let’s go ahead and get started building your automation.

00:02:21

Now, in this example, I’m going to go ahead and utilize the native browser version of the commands.

00:02:25

This is important in order to help showcase the recorder that we have built into OpenBots studio that works seamlessly. Once we have the appropriate extension installed.

00:02:30

So to begin, I’m going to have to have the automation actually open up an instance of the appropriate browser. To do this I have to search for the appropriate create application command that will allow me to do so.

00:02:42

Once again, this is going to be dependent on whether you’re going to use the Selenium or the native browser.

00:02:47

So since I’m going to be using their browser version, I’m going to go ahead and perform Search for native browser create application.

00:02:54

So, you can see here, don’t add the command here we have all different parameters. Now that we have to fill in to utilize these command properly.

00:03:00

The first one is called Native browser instance name. This works very similarly to how we work with Excel or early Word-type applications.

00:03:07

Essentially, what this allows us to do is, since we can have multiple instances of an application open at any given time, this parameter allows us to create a variable that allows us to store the information that defines this particular instance of the browser.

So that future commands can utilized in the same project, all we have to do is reference that variable to allow the automation to understand which version of the browser it needs to interact with.

00:03:28

So, let’s go ahead and create this variable. All we need to do is click into the parameter value here and then utilize the control plus K hot key.

00:03:37

This takes us to the variables manager tab. From here I’m going to go ahead and select new to indicate I’m creating a new variable. And from here I’ll be able to define the actual variable that I’m creating.

00:03:45

First, I have to give this a new name. So, I’m going to call this particular variable, V browser and next tab select the appropriate type.

00:03:55

Whenever we’re working with instances then using a variable to store that information, we have to utilize a type that’s located here in the bottom of this dropdown called OB App Instance.

00:04:02

This is a unique variable type that we have available in OpenBots Studio specifically designed for this particular purpose.

00:04:09

With this selected, we can go ahead and click OK to create the variable.

00:04:12

This takes us back to the variables matters window, and once we click OK once more from here, it’ll take us back to filling out the parameters for the associated command.

00:04:21

You can see here that now under the native browser instance name parameter, we have the V browser variable listed here.

00:04:26

The next step is going to be to indicate the browser engine that I’m going to be opening using this command.

00:04:31

By default, it will select the Chrome browser.

00:04:34

However, you can see that we have a dropdown option that allows you to select one of the other browsers that we currently support as well, including Edge as well Firefox.

00:04:41

In this example, I am going to be using Chrome, so I’ll leave it as the default option.

00:04:46

You didn’t have to specify a URL, so this is essentially the URL page that will be opened when you first open the browser itself.

00:04:51

Since we’re just performing Google search, I’m going to go ahead and indicate here that I simply wanted to navigate to the Google.com site.

00:05:00

With that we can go ahead and click OK to go ahead and add the command to automation. Let me go ahead and get rid of this little show message command that’s always sort of a placeholder for any new products we create.

00:05:11

Now, once we open the actual Chrome browser, this is basically when we’re going to go ahead and start actually interacting with it.

00:05:17

Now you can always just open the browser yourself 1st and navigate to the page before you actually start capturing and performing and adding all the different commands.

00:05:25

However, I always find it easier after I’ve added this native browser create application command to give my code a quick run and have an instance of that browser opened up for me.

00:05:35

This makes sure that we’re capturing all the X path parameters that you’ll be seeing me discussing in a second in the same way that it will be when the automation actually executes.

00:05:47

So, you can see that when executing the code, it went ahead and opened the Chrome browser and the Google search page.

00:05:52

We go and click on close here to close the log window. And this is basically what I’m going to be using in order to build the automation here.

00:06:00

So, at this point, what I need to do is to go ahead and type into the search bar. What I want to search for.

00:06:04

So in this case it is going to type in here Google stock in order to look up the current stock price for the Google company. To do that, we navigate back to OpenBots. Studio.

00:06:16

Once again, utilizing the same native browser commands, I’m going to go ahead and search for native browser set text. So this command is utilized in order to actually type into any search bar located on any website.

00:06:27

It’s important to note here that, although I am using just the Google search page here that these commands will work in the same way according to any website you’re currently using.

This will work with any particular text field that you may encounter on any site.

00:06:40

Here you’ll see that once again it will ask us for again for that native browser instance name. This is why we created that variable before.

00:06:46

Instead of having to do anything complicated procedure in order to indicate the specific instance you’re trying to interact with, all we have to do here is click on insert variable argument.

00:06:55

From here you’ll see the full list of the variables that we currently already have built in to our project and select the V browser variable.

00:07:04

Now this next section is going to be confusing, so let me explain.

00:07:08

This one so this one is called the element search parameter.

So, this particular section is utilized in order to help the automation understand and identify the specific elements on screen that it’s supposed to interact with.

00:07:18

To do so, it requires information about the different parameters associated with the element to be specified.

You can see here that by default it already has some parameter names listed out here.

What you can do here is basically manually insert the parameter values associated with the element on screen they’re trying to interact with.

00:07:35

However, there’s no other way that we can also get this information.

00:07:38

You can see here that underneath the element search parameter name, we also have an option here called Native element recorder.

00:07:44

The OpenBots studio is actually built with some inbuilt recorder features that allows you to automatically capture element parameters for you.

00:07:52

Since we’re working with the native browser, the recorder that is associated with this particular elements is the native element recorder.

00:07:59

You’ll see here when I click on this, this will go ahead and sort of minimize OpenBots Studio and you’ll see at the top left we get a little window that just lets us know that we have a couple hotkeys we can now use, either hitting escape to end the recorder or F2 in order to delay.

00:08:13

The delay is basically used in order to help you capture hidden elements, right? So let’s say for example, you’re trying to capture a sub option of the file menu.

00:08:20

If you need to capture one of those sub elements, you can simply hit the delay hot key, then click on file and then once the delay has ended, then captured the specific sub element you need from there.

00:08:30

We won’t need to be using that from here, but I just want to bring that up just so you understand how these features can be utilized.

00:08:36

Now at this point, the recorder is active and it’s basically waiting for your input in order to identify the element it needs to capture.

00:08:43

So you’ll notice here that as you move your mouse cursor around the different elements will begin to be highlighted as you move the mouse cursor over them.

00:08:49

This is due to the fact that we have the extension installed that is able to interact natively with the browser to identify all these different elements.

00:08:55

Capturing element is simply a matter of moving mouse cursor over the particular high-asset field you’re trying to capture. In this case, the text field for it to perform search, and once highlighted, simply left click.

00:09:06

Once you do, you’ll notice here that OpenBots Studio will pop back up to the window for pulling out different parameters

00:09:10

Except this time you’ll notice now that all the parameters listed inside the element search parameter fields are auto populated for you.

00:09:19

At this point, you can always go back if you’re running into any issues with your automation. You can always go back here and manually change these values as needed.

00:09:28

We also support wild card characters and the ability to pass in variables instead of hardcoded values as well, so there’s a lot of versatility for you to basically define these parameters as needed, depending on the site and your performance that you’re perceiving as you test out your automations.

00:09:42

So with the actual parameters specified, now that the bot actually knows what field is supposed to interact with, the next field is the actual text that needs to type into that associated element.

00:09:52

So right here on the text set is where we’re going to specify they’re trying to search for the Google stock.

00:09:57

I’m going to type Google stock. So after this you’ll see here that after we typed in the text to set, we have some additional parameters for specifying exactly how the particular element is going to be interacted with.

00:10:12

For example, you have the option here of clearing text. If that field already has some information typed into it, this simply allows you to indicate that it should first delete the information there before typing in the actual text that you want to populate the field.

00:10:24

So in our case, we do want to make sure that it is only searching for Google stock, so just for safely, we’re going to go ahead and leave the clear text options set to yes as well.

00:10:32

Now you’ll notice the little option here listed underneath it is the simulate type.

Another thing to keep in mind always with OpenBots Studio is that if you ever have questions about what any parameters being used for or anything like that, you can simply mouse the cursor over the name of the parameter and you get a brief description of what that parameter is used for.

00:10:48

So in this case, for example, you can see that with the simulated type it states that select with the text should be typed as simulated using the target application. If not, it will send keystrokes to target elements.

00:10:58

Basically, all this means is that if you choose yes option for the simulate type, it’ll go ahead and interact with that particular element using the browser settings itself.

00:11:05

Or if you leave it as a No option, which is the default option, it’ll send in the text information the same way that the user would by simply typing in the keyboard by sending those simulated keystrokes.

00:11:17

I’ll go ahead and leave this No, but keep in mind that if you want to help improve the performance of your automations, choosing the Yes option will be a bit quicker, so it may be an option you might want to look into.

00:11:28

The next parameter that you need to take note of is the timeout seconds option here. You can see here that by default it has the value of 30.

So in the event that when the automation executes, it is not able to immediately search for the elements.

00:11:39

This allows you to determine the amount of time that the automation should continue attempting to search for it before throwing an exception.

00:11:45

By default, all these different commands that interact with the browser will have a 30 second timeout, but you can always feel free to manipulate that and change this value based on your circumstances.

00:11:54

Maybe perhaps, for example, you’re working with a browser that just tends to work a bit slower than loading up the page, so maybe you want to extend the time on it—things of that nature.

00:12:03

In my purposes, however, I’m going to leave it to the default value of 30 seconds and with this we can go ahead and click on OK to add the commands as well to our command here.

00:12:11

So now that we typed in what we want to search for in the Google search bar, now let’s go ahead and have the automation perform the search itself.

00:12:18

If we were to simulate the steps ourselves or how we would do it ourselves in a browser, of course we would go ahead and do the same thing.

We would type in Google stock and then we would have two options.

00:12:27

A lot of us would simply hit the enter key in order to have it go ahead and perform the search or we always have the option here.

If we click outside the field, you can see that we have the Google search button that we can always click on in order to perform the search itself.

00:12:39

If we wanted to, we can simulate these two steps using automation as well.

00:12:44

If we did want to have the automation click on this Google search button here, what we can do is go back here into our OpenBots Studio and search the native browser click Element Command.

00:12:55

So this is the command that you want to utilize if you need to perform the mouse click on any element that’s located in your browser.

00:13:01

So by clicking on the native browser click Element Command, you’ll see here that the parameters again for the specific command will be displayed.

00:13:010

And you’ll notice that this looks very similar to the set text command that we just used.

00:13:12

Once again, you’ll indicate the native browser instance name, so that understands which browser instance is trying to interact with.

00:13:18

You have the element search parameter that you have to define the different parameters so it can actually identify the specific element to interact with.

00:13:24

That of course has the native element recorder that you can use to help you extract that information for you.

00:13:30

And then afterwards is where you’ll see the parameters that are unique to that particular command that you’re utilizing.

You’ll notice that as you use all the different native browser or even the selenium-based ones, they all work exactly in the same way.

00:13:41

Instance names reference the browser element search parameter to identify the elements and then the unique specific of parameters available for that particular command as well.

00:13:50

Now I’m actually not going to utilize this particular command, I just want to show that this is an option of how you click on the Google search button.

00:13:56

Instead, I’m going to go ahead and have the user send the enter key, and there’s actually a reason I’m doing this.

00:14:01

If I go here and try to type out again the Google stock, notice here that what tends to happen when you click inside the text field, you get this little drop down where Google tries to help you out by giving you suggestions of what you’re trying to type out.

Or you can just click on the option there and form the search.

00:14:17

But you’ll notice that it inadvertently covers up that Google search button.

00:14:20

If we try to tell the automation to click on that button, there’s a good chance that that drop down for the suggestions is actually going to block the button, preventing the automation from being able to interact with it correctly.

00:14:31

It might be better instead to just have the automation send the enter key the way most users probably would perform in search itself.

00:14:38

So again, you can also use the set text command to kind of simulate sending the enter key as well.

00:14:42

There’s a way to do that, however I want to show you a different command.

00:14:45

You can also utilize in order to perform the same functionality.

00:14:48

We have a different command called Send advanced keystrokes.

This command is utilized in order to send any kind of keyboard common keystroke combinations that you need to for your automation.

00:15:02

For example, if you needed to save a file, sometimes you would tend to use the control plus S hot key in order to save changes.

00:15:08

So this would be a command that you can utilize to simulate the exact same process by specifying the control key and yes key in that they should be pressed at the same time in order to perform that keystroke.

00:15:20

So in this case we’ll see here that we use the send advanced keystrokes command it will give you an option of indicating the specific window that you’re trying to send this particular keystroke combination to

00:15:29

By default, as you can see here, it has the value of current window.

00:15:33

All this means essentially is that if you leave it as default value, whatever window happens to be the active window at that particular moment in time on your desktop, that’s going to be the one that’s going to receive this particular signal of the keys that you try and send out.

00:15:46

However, you have here the dropdown you can also utilize in order to specifically choose the specific window you want to interact with.

00:15:52

So if I wanted to choose specifically the Google Chrome window, let it know that the Chrome window is the one I’m trying to interact with.

00:15:58

However, at this point I’m pretty confident that my automation is going to be on the Google search bar, so I should go ahead and leave it as default option here instead of making any changes.

00:16:06

But just keep in mind that, if in practice, when you’re actually performing your automations, if you find a little bit less reliable where it’s not sending the correct location, you have the option of controlling that bit using the window name itself.

00:16:18

Once you selected the window you want to interact with, the next thing is to indicate the keystrokes you’re trying to send out to it.

00:16:26

So you’ll see here there’s two columns. One is the actual key itself that you’re trying to send out, and the 2nd is to indicate the action to take.

00:16:34

So first in this case, since all I’m trying to do is send the enter key, I’m going to use this dropdown option here under selected key.

00:16:40

And select the enter return option.

00:16:43

Now I have to now select a particular action to take with that key.

00:16:48

So you notice here this is going to be a dropdown that has three different options.

00:16:51

Key press—up down up. Key down and key up.

So what this has to do is trying to simulate the different interactions a user can take with a key.

00:17:02

The first case here at the key pressed, where it says down plus up, is simply going to interact with the key the same way that a user word when they simply press it, where they press the key down and then release it to let go.

00:17:11

However, sometimes, especially when trying to do hotkeys and things like that, you might have to hold down on a particular key if you’re trying to select multiple files—things of that nature.

00:17:20

In order to simulate the action of holding down the key, you have the second option to indicate key down, which will instruct the automation to have that simulated action of simply holding down that key until given further instructions.

00:17:31

Now, if you did have a key pressed down previously, and now you want the automation to let go of that key, that’s when you realize the third option and it says key up.

00:17:39

Basically, just stop pressing the key from this point forward.

00:17:42

In this situation, I simply wanted to just press the enter key as normal, so I’ll select the first option called key press down plus up.

00:17:50

You can see here that as I entered this first option here for the entry key, I received another row, that if I wanted to, I can keep adding additional keys to send a combination of keys all at once.

00:18:01

All I need to do is the enter key here. I’m going to go ahead and press OK to add the command.

00:18:09

This will go ahead and send enter key.

00:18:11

So let me go ahead and simulate the step here on the actual Chrome page by sending the enter key.

00:18:15

This should be the next page that we see once we form the search itself.

00:18:20

You can see here that I currently have the price listed right here on the screen, so this is the information that I want to extract now as my next step.

00:18:27

So once again, just as before, we have a specific command that we can use to extract data from the current webpage.

00:18:33

Based on whether you’re going to use selenium or native browser, make sure you search for the appropriate one.

00:18:36

So in my case I’m using native browser ones, so I’m going to search for native browser.

00:18:41

In this case it is going to be get text.

00:18:45

But just like the other commands we’ve seen so far for interacting with the web browser, we’ll take the same steps here.

00:18:52

Indicate the instance name. In our case, V browser variable, and then capture the parameters for that particular element.

00:18:58

Again I’ll use the native element recorder.

00:19:01

Then highlight the elements, so in this case, the price and left click on it.

00:19:05

And we can once again verify that the actual parameter values have all been updated.

00:19:09

In this case, for example, this price can constantly change, right? So, depending on when I run this automation, the numerical value here can change.

00:19:20

But what this can mean is that sometimes, depending on how the automation captures the parameters, the parameter values themselves can sometimes hold those unique values as part them.

00:19:29

You always want to double check that none of these two selected parameters hold the current price listed as part of the actual value that’s passed in there.

00:19:38

You can just mouse over, especially if it’s not going to all fit into that one screen to double check.

00:19:43

I can see that the X path does not contain the actual price in it, so we’re fine there.

00:19:48

Then it’s also using the relative X path as well, so let’s go ahead and highlight this here, and looks like there’s nothing there as well—so we should be good to go.

00:19:54

We always keep in mind that double check for any kind of hard coded values in there that could change in future runs and making change adjustments as needed.

00:20:04

And also bear in mind that these parameters don’t work that were selected by default by the recorder.

00:20:08

You can simply disable the parameters you don’t want to utilize and enable the ones you do by using the appropriate checkbox next to that particular parameter name.

00:20:18

All we have left to do under the output text variable is to give it a variable that I can use to store the data that I just extracted from the website.

00:20:26

Let’s use the control plus K hotkey again and press on new to indicate we’re trying to create new variable.

00:20:32

I’ll call this one V stock.

00:20:35

And this will be a basic string type variable that I’m going to use to store a text-based data.

00:20:40

From here we’ll click on OK and OK once more to finalize creating the variable.

00:20:45

And with that, we’re ready to click OK to add the command into our code.

00:20:51

Now that we’ve extracted the text, the actual stock price that we were looking for, I’m just going to do a basic show message command in order to have the price list displayed on screen.

00:21:02

You can see the show message is very straightforward. It simply asks you for the message that you want displayed.

In my case, it’s going to be the stock price stored inside of the V stock variable.

00:21:13

And you also have the option here when using the show message command to indicate whether you want the window to automatically close after a set amount of time.

00:21:20

By default, you can see the value is 0. What that means is that the automation should not close the window on its own.

It should wait for user input to close the message box manually before continuing to the next step in the automation itself.

00:21:32

I’ll go ahead and leave this at zero just so I can have control of when the message box will disappear.

00:21:36

And press OK to add the command.

00:21:38

So now that we’ve finished with the actual functionality of the code itself, the last step is going to be to clean up after itself by closing the Chrome browser.

00:21:47

To do so, I will search up the native browser close application command.

00:21:55

And all this requires is the instance name referencing the browser. In this case, it’s the browser variable.

00:22:03

And with that we have finished building out the code for automations.

00:22:06

So just to kind of reiterate and go through these commands really quickly.

1) Start off by using the native browser create application command to open up an instance of Chrome on the Google search page.

00:22:15

2) Use the native browser set text command in order to type into the search bar what we’re trying to search for in this case, Google Stock.

00:22:23

3) Use the consent advanced keystrokes command in order to send the enter key to perform the user interaction of performing the search.

00:22:30

4) Use the native browser get text command to extract the stock price from the newly navigated web page and do a show message to display it to confirm that we have that captured the price correctly.

00:22:40

5) And finishing off, close the show message by using the Native browser closed Application command to close out the browser.

00:22:47

So with this, let’s go ahead here and close out the browser and give it a quick run to verify that it’s working as expected.

00:22:56

Once again, you get the log one at the bottom right to confirm the automation is running and we can see here the browser has already opened to the Google search page.

00:23:02

Let’s take a moment here to type in Google stock, perform the search.

We can see here that it has already navigated to the page, extracted the price and the message box has appeared, and we can see here that it does equal value that we were expecting from the page itself.

00:23:15

So now if I click on OK to close out the message box, the last step should be is the Chrome browser actually closing it out.

00:23:23

And there we go. The Chrome browser has been closed and we get this text indicator on our log message window that lets us know that everything went through without any exceptions.

00:23:31

In this particular example, I didn’t run into any exceptions.

However, it’s very common, when working with web automations, that you’ll run into a UI element not found type of exception.

00:23:41

These usually occur when you’re working with commands such as the set text or get text commands.

It’s usually an indicator that the parameters you specify to identify the element are not working as expected.

00:23:50

When you see these types of exceptions, always go back to the command that caused the exception and double check some of those parameters.

00:23:56

It’s possible that you may have ended up with some hardcoded values or something of that nature that may need to be altered.

00:24:01

For example, maybe the parameter has a value that changes every time the instance of the browser initialized.

00:24:08

That might require you to use things like a wild card character or maybe it’s an indication that one of the other parameters should be utilized in its place.

00:24:16

This can happen frequently depending on the site you’re working on as each website is built differently and some will be easier to work with than others.

00:24:22

Don’t be discouraged if you constantly run into these types of exceptions that require you to constantly make changes to the parameters.

00:24:28

Just bear with it and experiment a bit around.

Eventually you’ll find the right set of parameters that allow you to identify that element, and it will allow you to resolve that exception.

00:24:36

And with that we successfully completed our first web-based automation.

00:24:39

In this example we learn the fundamentals between the selenium-based commands and the native browser commands.

00:24:45

We then use the native browser-based commands in order to perform a search using the Chrome browser and then extract some data.

00:24:51

Although in this example we only use the Google search page in this process we built, these same fundamental concepts and commands can be used for all sorts of different websites and web pages that you might need to interact.

00:25:03

Although we used Chrome here, the native browser commands can be used with different browsers, such as Edge or Firefox.

00:25:11

As long as you learn these fundamental concepts and commands, you can use these to build all sorts of complicated business processes based on your needs.

00:25:20

I hope you’ve enjoyed this video and happy automating.