Drive keyboard actions

Watch this video to learn how to add text as part of an automation flow.

What you learn in this lesson

  • How to add text.
  • How to use special characters and key combinations.
  • How you can control the speed of typing.
  • How to use “Type as keys” for terminal clients like Citrix etc.

Lesson Overview

Watch this video to learn how to add text as part of an automation flow.

What you learn in this lesson

  • How to add text.
  • How to use special characters and key combinations.
  • How you can control the speed of typing.
  • How to use “Type as keys” for terminal clients like Citrix etc.

In this video we will take a closer look at the TypeText building block. Whatever of text, special key combinations and key strokes you want to insert, this is the building block to use.

The building block will insert the text specified when the block is executed, and the text will be inserted wherever the focus is. It could be a field, the address bar of a browser, a document, a mail etc.

I will start by just adding some text into a notepad. This simple operations is probably a good example of most uses of the TypeText building block.

I have a notepad running in the background and will add a type text block to the Start block.

  • Add “Hello World”
  • Run the case

So very simple. Just inserts the text specified.

We can also use fields, to compose messages from multiple building blocks.
In this case I’ll exemplify this by adding “Set Text” block.

  • Add “Set text”, add “Leaptest”
  • Expand Type Text

I now drag the text value to a new FIELD in the TypeText block

I can now use the FIELD in the text value field.

  • Add FIELD to Text Value
  • Run the case

Another way of using the TypeText block is to capture key-combinations. For instance if we want to open a notepad, we could press the windows key and “R”, to open the Run window, and then type notepad.exe.

Let’s put this in front of the existing building block.

  • Add TypeText

To capture a key combination I will enable Capture and press “windows+R”. This will add the combination as a purple brick in the text value field.
Disable Capture and enter notepad.exe.

We need to end this sequence of text by adding an ENTER.

Enable CAPTURE again, press ENTER, and then disable CAPTURE again.

  • Run the case

Notepad opened and the text added.

Be aware that sometimes you need to use the “Await no movement” property, to ensure that notepad is actually opened before the text is inserted.
This property means that the insertion of text is not done before the screen is not changing anymore. Typically meaning that notepad is opened and ready to accept the text.

You can change the type from Text to Password. This means the text that you enter into the text field is shown as dots. This is only design time, to prevent people from sniffing password by inspecting test cases. At run-time the text will be inserted as normal, and it’s up to the receiving application – for instance a login form – to prevent people from seeing the password.

The Keyspeed is the speed at which the text is inserted. Some applications need a slow insert to verify type-ahead and auto-completion features.

To reduce the time used running the case you can set it to fast. It can sometimes stumble, so test it a few times before using this value.

Let’s try running it.

  • Run the case

As you can see, a little faster than most people can type. Actually the fastest way of inserting text is by using the Clipboard. It’s not covered in this video, but look in the advanced section in the learning center for videos about the SetClipboard building block.

The last thing I’ll cover in this video is the “Type as keys”. With this enabled, the text entered is not send as characters, but as key strokes. This is typically needed when the application you are automating, is accessed through some kind of terminal or is based on some older development frameworks.

This could be Remote Desktop, some Citrix apps, 3270 terminal and other similar solutions. We have also seen it necessary in some old Java-based applications, but there might be more examples.

This end the walk-through of the Type Text building block and how to add text as part of an automation case.