Open Browser headless not rendering page

Hi All,
I have issue with one URL which doesn’t render properly with new page or even headless Open Browser. If I use headless=false in Open Browser the page is rendered correctly and all buttons are visible and automation works fine. For Headless =True or new page, it doesn’t work. In prod all this is running in docker container and hence I don’t have option of use open browser headless = False option.

The url is How much can be borrowed calculator | The Mortgage Works for Intermediaries
Any pointers or suggestions that I can try while setting new_context()?

Thanks in Advance

Hi @SNavgale ,

My initial thought is it might be related to viewport size?

If it’s not that, then it might be taking longer to render the page when headless, i’ve never seen that, but I know some OS’s lower the priority of the non-forground windows, so it’s possible a javascript heavy page might take longer to render. If this is the issue it’s easily fixed with Wait For Elements State.

Hope that helps,

Dave.

1 Like

this is the screen grab on headless:

As @damies13 has pointed out with rendering that this seems to be a possible the cause, if you was to apply a sleep while headless to confirm this for example it will render all elements as you see when not in headless.

Using a keyword as suggested would be a valid approach, I’m not a fan of sleep but this is a good way to debug/confirm.

Something I used to do, in a different language as it never had supporting keywords as we have with RF was to have an is visible method that you run before interacting with a page when breaking out your site with the page object model, this was to ensure a page has loaded, so the concept here is very much the same, you could get the longest loaded element from dev tools if you wanted to push it one step further, but using a keyword as pointed out should fix your problem.

Thanks @damies13 and @_daryl
I tried delay up to 100 seconds in addition to Wait For Elements state on Logo/button to be visible but page just doesn’t render properly. I am not html/JavaScript expert but now checking with others if there is any javascript that I need to check/execute or is it just issue with css not loading?

No worries @SNavgale - hmmm also this may be because the website detects it’s a headless browser and disables some features. From what I’ve read setting a user agent as an option could fix the problem for you, at least its a place to have a look into/play around.