My test script passed when i execute using a browser but failed when headless

During headless execution, i got this error:

Caused by: com.kms.katalon.core.exception.StepFailedException: com.kms.katalon.core.webui.exception.WebElementNotFoundException: Web element with id: ‘Object Repository/scr_memorityConnection/a_Terms of Service’ located by ‘By.xpath: //a[@id=‘linkTermOfService’]’ not found

1 Like

Hello. Do you have a solution for this?

No solution yet :frowning:

1 Like

The problem may be due to timing issues, try to add a WaitForElementPresent before action. Another possibility is that the HTML is different in headless mode compared to GUI mode. To test this, you can try to write

DriverFactory.getWebDriver().getPageSource();

Which will print out the HTML of the page. Look in this source to see if the element you’re looking for is there.

1 Like