While running testcafe, I could see an xhr request failing in the background and may be that is why I could not see the UI elements of the page getting loaded. I could see only one element loaded.
If I try to access the same webpage without testcafe, I could see the page elements loading normal although the xhr request is still failing in the background.
Could this failing xhr request be a reason for the page not showing all the UI elements when I do it through testcafe?
Is there a way to ignore some xhr requests like this in testcafe ?
To mock any request you can use RequestMock. For example:
const mock = RequestMock() .onRequestTo('http://xhr-request/') .respond('Mocked respond');