Running by Command Line in Chrome headless mode in MacOs

Hello y’all.

I’m trying to do scrapping in headless mode, to save processing power that I don’t have :sweat_smile:, but something is going wrong.

I already tested my script on Chrome “full” mode (with GUI) and it’s working perfectly, and also tested the autostart HTML, with all parameters set and everything works fine.

I’ve followed the procedures on documentation of using osascript -e on Terminal but didn’t work at all, so I found somewhere this solution that worked pretty good without the –headless switch:

alias chrome=“/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome”

chrome --dump-dom “file:///Users/t/Desktop/test/uivision.html?direct=1&macro=test&savelog=demotestlog.txt”

The problem is when I run the command into Terminal with –headless switch, I’m getting the following error:

alert('Error #203: It seems you need to turn on *Allow access to file URLs* for Kantu in your browser extension settings.')

I already allowed this into extension properties and if I ran without the switch, no problem at all.

Can someone tell me if the problem is the extension in itself is not loaded using headless mode?
And, if its the case, there is something, anything that can I do to run the scripts in a headless mode?

Thank you so much!
(It’s my first post ever in this forum, I’m sorry if I’m doing something wrong)

1 Like

Yeah, the issue is that the RPA software does not run in headless mode. But if you only use Selenium IDE compatible commands then you can run the browser in background.

If you use UI testing commands, then the browser (or the desktop app that you are automating) needs to stay in the foreground and the machine unlocked. This is a limiation for all UI automation tools.

Hi Admin, I also have the requirement to run Chrome --headless on Apple. The following terminal command line runs my UI.Vision macro fine:
/Applications/“Google Chrome.app”/Contents/MacOS/“Google Chrome” ‘file:///Users/jamacoe/Documents/Favoriten/uivision/ui.vision.html?macro=Favoriten&cmd_var1=1&closeRPA=1&closeBrowser=0&direct=1&nodisplay=1&continueInLastUsedTab=0’
But when I add --headless then I get the console message:
[1111/152946.972186:WARNING:angle_platform_impl.cc(49)] RendererVk.cpp:1962 (initialize): ANGLE VMA version: 2003000
I think I’m not using UI testing commands.
Any idea or help?

Hi, headless Chrome is a powerful tool, but it may not render pages exactly the same way as a standard, non-headless Chrome does, especially if the page heavily relies on GPU-accelerated rendering.

The error message you’ve encountered is related to ANGLE (Almost Native Graphics Layer Engine), a graphics engine abstraction layer used by some applications and games to translate OpenGL calls to other graphics APIs like Direct3D or Vulkan.

Could that be? Are you trying to run a graphics-heavy website on Chrome? Or, as a test, do you get the same error if you try to automate a simply website such as our own, https://ui.vision ?

Thank you for picking up.

I’ve tested a bit more and now it seems like a Chrome issue (or I just don’t know how to do it). If I start:
/Applications/“Google Chrome.app”/Contents/MacOS/“Google Chrome” “<…any URL or ui.vision.html…>”
Chrome will work normally and ok,
but if I add --headless --disable-gpu --remote-debugging-port=9222
and then try to verify in a different browser window (http://127.0.0.1:9222) there’s only a blank page, even with minimalistic sites like example.com
So I have problems with ‘headless’ in general, not UI.Vision specific, thus it’s off topic here.

However, it would be nice to have. I want to load a web page on a regular scheduled basis in the background to update some data, and I don’t want the user to be interrupted. Has anyone ever got ‘headless’ running with Chrome+UI.Vision any executed any meaningful script? Please tell me how.

My solution is to run everything inside small (and free) Ubuntu 20.04 virtual box machines. The VM can run in the background, and inside the VM Chrome+RPA run in normal mode.

1 Like