How i record the sign in website step

I try to record the sign in step of the website but the katalon did not record it

How do I record this step?

2 Likes

Hi Khoa,
def setTextbyJavaScript(String text){
Robot robot = new Robot()
StringSelection stringselectionObj = new StringSelection(text)
Clipboard clibBoardObj = Toolkit.getDefaultToolkit().getSystemClipboard();
clibBoardObj.setContents(stringselectionObj, null)
robot.keyPress(KeyEvent.VK_CONTROL)
robot.keyPress(KeyEvent.VK_V)
robot.keyRelease(KeyEvent.VK_CONTROL)
robot.keyRelease(KeyEvent.VK_V)
Thread.sleep(500)
}

3 Likes

**Create a keyword in katalon studio and copy the below code. I have used ADMIN as the user and password. It can be modified and optimised further **

call this keyword in your test case

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject

import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.checkpoint.Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.testcase.TestCase
import com.kms.katalon.core.testdata.TestData
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows
import java.awt.AWTException
import java.awt.Robot
import java.awt.event.KeyEvent
import org.openqa.selenium.By
import org.openqa.selenium.WebDriver
import org.openqa.selenium.WebElement
import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.webui.driver.DriverFactory
import internal.GlobalVariable

public class notipopup {

@Keyword
def handlepopup() {
	// Create a new Robot instance.
	Robot robot = new Robot()


	// Enter the username.
	robot.keyPress(KeyEvent.VK_A)
	robot.keyPress(KeyEvent.VK_D)
	robot.keyPress(KeyEvent.VK_M)
	robot.keyPress(KeyEvent.VK_I)
	robot.keyPress(KeyEvent.VK_N)

	// Press tab to move to the password field.
	robot.keyPress(KeyEvent.VK_TAB)

	// Enter the password.
	robot.keyPress(KeyEvent.VK_A)
	robot.keyPress(KeyEvent.VK_D)
	robot.keyPress(KeyEvent.VK_M)
	robot.keyPress(KeyEvent.VK_I)
	robot.keyPress(KeyEvent.VK_N)

	// Press enter to login.
	robot.keyPress(KeyEvent.VK_ENTER)
}

}

2 Likes

Please use the “Code Formatting” for better readability.

2 Likes

That pop-up cannot be recorded because it’s a Chrome window pop-up. The Katalon Recorder only records the Web page content.
You can capture it by taking a full desktop screenshot. Refer to Capturing Screenshot Using Robot Class In Selenium