Katalon and setHttpHeaderProperties ... how?

How can I integrate setHttpHeaderProperties into katalon? I’m afraid I’m new to this, so I don’t see how to do it. I’ve searched the doco, and google several times without luck.

I want to call it to set up a few parms before running some tests.

Any suggestions would be much appreciated!

Thanks from down under.

Ed

What is “setHttpHeaderProperties” you mean?
I don’t know it at all.

It’s a routine that allows me to set an HTTP header. e.g.

RequestObject RO

‘Create new ArrayList’
ArrayList HTTPHeader = new ArrayList()

‘Send token in HTTP header’
HTTPHeader.add(new TestObjectProperty(‘Authorization’, ConditionType.EQUALS,‘user’))

‘Set that token’
RO.setHttpHeaderProperties(HTTPHeader)

‘Get response text’
response = WS.sendRequest(RO)

I copied this from another question, but don’t know how to integrate it into katalon.

What is this RequestObject?

I do not know anything called RequestObject in the “Web Testing” domain in Katalon Studio.

Do you know its fully-qualified-class-name?

https://docs.katalon.com/javadoc/com/kms/katalon/core/testobject/RequestObject.html

I am confused.

You posted this question into the “Web Testing” category.

But com.kms.katalon.core.testobject.RequestObject is only used for the “API Testing”, is not meant for “Web Testing”.

Which of them — “Web Testing” & “API Testing” are you going to perform?

In other words, do you want to use “WebUI.openBrowser()” and “RequestObject” together?

Ah, good question! I’m doing a web browser test, and want to set that http header. I have no idea if I’m on the right track or not!

I noticed that there is a previous topic similar to this, and @Brandon_Hein already provided an answer:

and you appended a post to it

I think that the Brandon’s answer is valid and most appropriate. You should try to understand it.

No, you aren’t.

I looked at his answer, and downloaded the code. It’s an entire server, and far far more than I can deal with! Why can’t I use use half a dozen lines of code? I don’t want to install a whole server, and have to figure out what it does, and why. That’s massive overkill!

Surely a simple question doesn’t need an entire server?!

Yes. Your requirement is more complex than you expect.
The way Brandon suggested requires a server and is proven to work for Selenium users.

I guess, but not verified, that there would be alternative method if your script make use of Chrome DevTools Protocol.

That’s amazing. So now I need to masterjava, groovy, katalon, and another server. And I thought katalon would make things easy to test :frowning:

Yes, you are right. As long as your test script uses Selenium WebDriver to communicate with browsers (in Katalon Studio you do).

Katalon has its own capability, but is not almighty.

According to https://stackoverflow.com/questions/62605422/how-to-add-custom-headers-in-playwright

It seems that a test script in puppeteer and playwright will communicate with browsers using Chrome DevTools Protocol (CDP for short). CDP enables your test script to add custom headers in the HTTP request from browser to server. Why not you try them?

If you are going to spend your time to learn something new to you, then learning CDP + Playwritht in Typescript would be more interesting than struggling with the “entire server”.

Sounds promising, I’ll have a look. Thanks for all your help, it’s appreciated!

BTW, nice cat. I adore cats :slight_smile:

His name is Marcus.