Can I work without Object Repository

I don’t want to use any other software like Katalon recorder. Is there any way to directly use the Id or xpath in the script like in Selenium.

There are two ways that I used.
One is to create only ONE single object in Object repository.
I called it DUMMY. And that object has no object properties. They are empty.
I set properties of DUMMY object in my code like this:

def myObject = WebUI.modifyObjectProperty(findTestObject(‘Object Repository/MyPAthToObject/Dummy’),

‘id’, ‘equals’, ‘FIND ID IN HTML CODE AND PUT IT HERE’, true)

And then you can use it like this:
WebUI.focus(myObject)
WebUI.click(myObject)
WebUI.setText(myObject, ‘Mytext’)
WebUI.sendKeys(myObject, Keys.chord(Keys.TAB))

Another way without any object in object repository is like this:

myTestObject1
= new TestObject(“customObject1”)
List
properties1 = new ArrayList()
properties1.add(new
TestObjectProperty(“id”, ConditionType.EQUALS,
“YOUR ID OF ELEMENT”))
//here you can add another property like class or whatever. I only added ID because it is unique and i don’t need anything other

//Set Object

myTestObject1.setProperties(properties1)

WebUI.click(myTestObject1)

1 Like

To add to what @5173-crokatalontest said, there is a lengthy discussion on the topic:

http://forum.katalon.com/discussion/comment/17374/#Comment_17374

Hi @5173-crokatalontest what if i don’t want any kind of object not even dummy object then?

I don’t want use the OR approach. Please suggest.

Hi Mayank,

and what do you want? How do you want to interact with browser? Or - what are you about to test if there are no test objects?

If you are comfortable in JavaScript, you can use it to access the elements of a page directly and avoid the OR completely.

2 Likes

Russ Thomas said:

If you are comfortable in JavaScript, you can use it to access the elements of a page directly and avoid the OR completely.

I am new to katalon script, can you please explain with example??

There are MANY examples posted here on the forum. Use the search facility so I don’t have to type it out yet again. :frowning: