seleniumkatalon-studiokatalon-recorder

Convert testobject into a string


I want to convert a test object to a string in a katalon

Output:

2021-04-11 21:49:21.775 DEBUG testcase.TimeHandler - 5: singInButton = findTestObject("Page_Login/button_Sign")
2021-04-11 21:49:21.931 DEBUG testcase.TimeHandler - 6: println("---------------->" + singInButton)
---------------->TestObject - 'Object Repository/Page_Login/button_Sign'

code that I am using

String singInButton = findTestObject("Page_Login/button_Sign")
println "---------------->" + singInButton

Solution

  • Please try something like the following,

    TestObject testObjectstring = findTestObject('Object Repository/Page_Login/button_Sign')
        
    String value= testObjectstring.getSelectorCollection()[SelectorMethod.XPATH]
        
    println "------------------>" + "'${value}'"