Make Money Online AUTOMATION Karate UI Automation Tutorial #16 – How to Highlight Element on Webpage

Karate UI Automation Tutorial #16 – How to Highlight Element on Webpage

Karate UI Automation Tutorial #16 – How to Highlight Element on Webpage post thumbnail image


Karate UI Automation is an open source tool that allows developers to create automated tests for web applications. It is based on the Selenium WebDriver library and enables developers to record user actions and generate test scripts in a variety of languages.

In this tutorial, we will show you how to use the Karate UI Automation tool to highlight an element on a web page. We will be using the Google Search page as our example.

First, we need to install the Karate UI Automation tool. You can do this using the following command:

pip install karate-ui

Once the installation is complete, we can start recording our user actions. To do this, open a new terminal window and navigate to the directory where you want to save your test script. Then, run the following command:

karate-ui record google-search.feature -t /path/to/chromedriver

This will launch Google Chrome and start recording your user actions. When you are finished, press Ctrl+C to stop recording. Your test script will be saved in google-search.feature file in the current directory.

Next, we need to edit our test script to add some logic. Open the google-search.feature file in your favorite text editor and add the following code:

Feature: Google Search

Scenario: Search for karate UI

Given driver ‘chrome’ //1

When click ‘https://www.google.com’ //2

And input ‘karate UI’ into ‘q’ //3

Then click ‘btnK’ //4

And verify title contains ‘karate UI’ //5

Scenario: Highlight element on webpage

Given driver ‘chrome’ //1

When click ‘https://www.google.com’ //2

And input ‘karate UI’ into ‘q’ //3

Then click ‘btnK’ //4

And verify title contains ‘karate UI’ //5

When highlight id(‘lst-ib’) with color(‘#FFFF00’) BEGINNING AT 2s FOR 4s //6 – This step highlights element with id lst-ib in yellow color for 4 seconds starting at 2 seconds

END

Related Post