Creating variables and reusing the values

I have created a variable by locating the variable String text using xpath in selenium, i then inserted the variable text into another field using the sendkeys method.

Can I do the same thing as described in my selenium script below in Katalon?, and if so can you please describe the steps.

String myVariableText = driver.findElement(By.xpath(“//input[@id=‘text’]”)).getText();

driver.findElement (By.xpath(“//input[@id=‘textNumber’]”)).sendKeys(myVariableText);
Thank you.

Hi there,

You can freely create variables in ‘Variables’ tab of a test case and then call it in manual mode. However, because the variable’s value in your case is retrieved during execution and it’s actually a selenium script. This kind of variable’s value will be treated as STRING if you call it in your test case after defining it from ‘Variable’ tab.


Hi Vinh,

This is because other colleagues will also be using this particular tool, and some of them are not comfortable with using script mode. I have scripted the scenario using java selenium in eclipse but would also like to know how you would cover the use of variable’s in manual mode in Katalon studios.


Hi there,

Can I ask why do you need to do this from manual mode? It will be very easy if you just do it in script mode


Thanks for the update, but what i’m looking for is how do you create and save variables and then call the variable in manual mode.

In manual mode, test steps are different. You can replace ‘send keys’ to input field with ‘Set Text’ built-in keyword of Katalon Studio. So test steps in manual mode looks like below:


1 Like

Thank you for the quick response, but can you also advise how i would do the same thing using Katalon manual mode please?

Hi there,

It’s exactly the same in Katalon Studio. Just add necessary imports and that’s all for what you have done in Katalon Studio

import org.openqa.selenium.By
import org.openqa.selenium.WebDriver

import com.kms.katalon.core.webui.driver.DriverFactory

WebDriver driver = DriverFactory.getWebDriver()

String myVariableText = driver.findElement(By.xpath("//input[@id='text']")).getText()

driver.findElement (By.xpath("//input[@id='textNumber']")).sendKeys(myVariableText)