GetText from URL1 and SetText to URL2 - SetText step fails due to (see below error)

Steps to reproduce the bug.

  1. In URL 1(booking system), create a reservation
  2. After successful creation, copy the reservation (I used GetText here)
  3. Then the script opens up a new tab for the 2nd URL (where I counter check if the reservation is made)
  4. I used SetText keyword here, which is expected to paste the reservation number in the textfield…

However I am getting an error messgage:

=============== ROOT CAUSE =====================


For trouble shooting, please visit: https://docs.katalon.com/katalon-studio/docs/troubleshooting.html
================================================

01-19-2024 11:11:20 AM setText(findTestObject("TestEnvironment OR/Page_Edit/GetText_ReservationNumber", s))

Elapsed time: 0.027s

Test Cases/Development Items/Create a member reservation and check booking in RMS FAILED.
Reason:
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.testobject.ObjectRepository.findTestObject() is applicable for argument types: (java.lang.String, java.lang.String) values: [TestEnvironment OR/Page_Edit/GetText_ReservationNumber, #364506]
Possible solutions: findTestObject(java.lang.String), findTestObject(java.lang.String, java.util.Map), findRequestObject(java.lang.String, java.io.File)
	at Create a member reservation and check booking in RMS.run(Create a member reservation and check booking in RMS:134)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:448)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:439)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:418)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:410)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:285)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:144)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:135)
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
	at TempTestCase1705633789410.run(TempTestCase1705633789410.groovy:25)
1 Like

Are you saving get text value in a variable ?

1 Like

Problem

It looks like you just used findTestObject() incorrectly…

That method takes the name of the TestObject… Typically found in Object Repository…

Solution

As you said, you were trying to use setText(). Looking a little bit closer at that error log that you posted, simply move the parentheses around the name of the TestObject, like this:

setText(findTestObject("TestEnvironment OR/Page_Edit/GetText_ReservationNumber"), s)

Use “getText()” if the reservation is a like a label or some other type of tag that is not an <input>. If the reservation is in an <input>, then use “getAttribute(findTestObject(…), ‘value’)”

use getText() to fetch the value and SetText() to set the value in desired page