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: […]
Recent Comments