Running test scripts in Headless browser

Test case is about adding a category and verify its added and then deleted the added category.
It works fine if I run the script in chrome browser but it fails if executed in headless chrome.
In headless script is failing as below (i am using katalon 7.3.1)

I have set the resolution as
WebUI.setViewPortSize(1366, 784, FailureHandling.CONTINUE_ON_FAILURE)‘Products/Add Category to a product/span_Type Category’))


WebUI.setText(findTestObject(‘Products/Add Category to a product/Search Category’), NewCategory)

WebUI.sendKeys(findTestObject(‘Products/Add Category to a product/Search Category’), Keys.chord(Keys.ENTER))

WebUI.waitForElementClickable(findTestObject(‘Products/Add Category to a product/button_Add category’), 20)‘Products/Add Category to a product/button_Add category’))

String AddedCategory = WebUI.getText(findTestObject(‘Products/Add Category to a product/Heading of new category’))


if (AddedCategory == NewCategory)

WebUI.verifyElementPresent(findTestObject('Products/Add Category to a product/a_Remove'), 5)'Products/Add Category to a product/a_Remove'))



} else
assert false