Selenium/Katalon a step by step introduction

Ok, so we want to use selenium in order to build a few tests or simplify our testing process. Easy thing, get Firefox and install Selenium IDE. Well no. You probably have Firefox Quantum and Selenium IDE is not compatible. Who uses 64bit anyway…?!

So we change course. Get Chrome and install Katalon Automation Recorder. You can find it in the official Chrome extension page. Click and install. Simple as that.

Before we start explaining all the available buttons of Katalon, you need to have a clear idea of what is a test suite and a test case. A test suite can be a page or specific action. For example our test suite is the “Login page” and the cases are:

1) Valid data

2) Invalid data

Every case is a different file. I wouldn’t recommend it but as I said before, you can have actions as suites. For example “Login” and your cases will be “Website login”, “CMS login”, “CRM login” etc…

Buttons time

New: By clicking on this you can create a new test case.

Record: With this you can record your steps in browser.

Play: Run the test case

Export: You can export your test case in different languages and frameworks.



Note: Next to the title of the left column, there are three vertical dots. Click on them to Open or create a new test suite/case.


Add: Add a new step

Delete: Delete a specific step

Delete all: Delete all steps from the active test case

Select: By clicking on this, it will switch to chrome and you can click on a paragraph or field. This way, it will pick the xPath of this location and it will transfer it to the “target” field below.

Find: It will indicate the location from the “target” field

Command: What to do

Target: Which field etc.

Value: Input data

Let’s build it

Simple enough, we will:

1) Go to google

2) Search for “wiki quality assurance”

3) Load wiki page

4) Go to “Software development” section

5) Verify an entire paragraph

Those are the steps:

1) Create a new test case (Click “New” – top left)

2) Give it a name

3) Add a new line in test case (Click “Add”)

3a) Command: open

3b) Target: https://www.google.com

Note: If you click “Play” it will switch to chrome and it will load google. Well done, you just build your first step.

4) Click “Add” (It will add a new line below the open command)

4a) Command: “type”

4b) Go manually to “google.com”

4c) Target: Click the “Select button” and click on the search field of google. In Katalon, in that field you will see “id=lst-ib”

4d) Value: “wiki quality assurance”

Note: So now you typed the phrase “wiki quality assurance” in google

6) Click “Add” again

6a) Command: “sendKeys”

6b) Target: “id=lst-ib” (Same as previous step)

6c) Value: ${KEY_ENTER} (Simulates the Enter keystroke)

Note: Now you will see the result page of google

7) Click “Add”

7a) Command: click

7b) Target: “link=Quality assurance – Wikipedia”

(Do not type it, use the “select” button)

Note: There are many ways to click on a link. For example, use the xPath, or the URL. In our case there is no possibility to find a second link with the exact same title. So it’s fine for now. As you understand, if there are two or more buttons/links with the exact same title, it’s not going to work… xPath!

8) Click “Add”

8a) Command: “click”

8b) Target: “//div[@id=’toc’]/ul/li[3]/ul/li[3]/a/span[2]”

(Do not type it, use the “select” button)


So now you just created your first test case. With the exact same steps, you can create a test case for login, register etc…

Selenium/Katalon is not just this. You can do mini calculations and move forward. There are many different commands and believe me the most useful will be the “wait” command.

Good luck mates.

Comments

Contact Us Now!


Social Media