Entering and reading text GetText, SetText and SendKeys in Katalon Studio

To get started with actual scripting, let’s look at two of the more commonly used functions, getting text from the website and putting text into a field or input box. From the Selenium IDE, these were referred to as storeText and type. StoreText is now GetText and Type is now SetText. There was also the SendKeys command, which is still available in Katalon. Going back to a previous example, here is a small dashboard with sales figures. In this example, I have defined the first cell of the table with the XPATH reference and created an object called Daily Sales Figure Main Dashboard. In order to retrieve that first value and store it in a variable, I can use the following command: dailySalesFigure = WebUI.getText(findTestObject(‘Page_/Sales Dashboard/Daily Sales Figure Main Dashboard’)) The variable dailySalesFigure will take on the value $44,931 and will be defined as a String. Using our Inventory Search field example, I have the following item on the page: […]

Global Variables – How to define your test environment

Before we get too deep into creating scripts I wanted to point out the use of Global Variables since several of the screenshots already reference something called GlobalVariable.baseurl + "/tasks" or something similar. I saw this referenced in several Katalon examples, but the reason for doing it wasn’t clear. If you recall from the Selenium IDE, there was a field where you could enter the base URL of the site. This meant you could run the same tests in QA and Production with just a change to the URL. This accomplishes the same functionality in Katalon Studio. The base URL is set for QA 99% of the time and when you want to run tests in Production, simply change the value of the Global Variable and all tests that reference that variable will use the new site address. In this example, I’m creating a variable called "baseurl". This contains the URL of my site in the QA environment. Click the […]

Katalon Studio – Manual View – The start of a test script

To start a new script, click the down arrow next to the New button and select Test Case. After being prompted for a name, you’ll be placed in the Manual view, which should look somewhat similar to the Selenium IDE and helps to build the framework of a test. Click the Add button to get a list of the commonly used commands like Set Text, Get Text, Wait for Page Load, Delay, Click, etc. At first the list may not seem as extensive as the old IDE, but don’t worry, Katalon can do everything the old IDE did and plenty more. Clicking the Add button, offers the short list of commands, while clicking the down arrow next to Add presents other actions like Decision Making, Looping, Branching and Exception Handling. As an example, a standard test can start by navigating to a page, clicking an item, reading text, waiting for a page to load and verifying an element exists. The […]

Katalon Studio – Creating Objects

The first thing to understand with Katalon Studio is that it’s object oriented. That means that every item you want to interact with on the page should have an object created for it. For example, if you want to enter text on a form, that input field would be an object referencing the path to find it. If you want to click the OK or Submit button on a page, there should be an object with the path to the button. At first, that may seem like extra work and perhaps even a waste of time. But in the long run, it’s very beneficial. You have to reference the object anyway, but this method gives it a friendly name and again, if the path to the object changes, it only needs to be changed in one place. As an example, let’s say you wanted to enter text into a form. Here is an input field on a real Inventory Search […]