ZAP chrome headless docker

257 views
Skip to first unread message

Hammad Ali

unread,
Aug 15, 2023, 12:40:18 PM8/15/23
to ZAP User Group
Hi,
I need help in starting chrome browser in headless mode, we are running in docker and have installed google-chrome-stable and chromedriver. Both are install in directory /usr/bin/ and setting chrome via python API

Enviorment
System info: os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.255-311-248.529.amzn2.x86_64', java.version: '11.0.18'

Python
zap.selenium.set_option_chrome_binary_path("/usr/bin/google-chrome")
zap.selenium.set_option_chrome_driver_path("/usr/bin/chromedriver")
zap.ajaxSpider.set_option_browser_id("chrome-headless")

CHROMEDRIVER_VERSION=114.0.5735.90 CHROME_VERSION=114.0.5735.90-1
But getting this error

Caused by: org.openqa.selenium.SessionNotCreatedException: Could not start a new 
session. Response code 500. Message: unknown error: Chrome failed to start: crashed. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) 

Simon Bennetts

unread,
Aug 16, 2023, 3:49:46 AM8/16/23
to ZAP User Group
Can you start Chrome in headless mode from the command line?

Cheers,

Simon

Hammad Ali

unread,
Aug 16, 2023, 4:06:03 AM8/16/23
to zaprox...@googlegroups.com
Is there something wrong with code though?

--
You received this message because you are subscribed to the Google Groups "ZAP User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zaproxy-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/zaproxy-users/1c2319f1-51fa-43c2-94c6-3cb8890ffd3cn%40googlegroups.com.

Simon Bennetts

unread,
Aug 16, 2023, 4:09:16 AM8/16/23
to ZAP User Group
I cant see anything obvious.
But you've installed Chrome in your image.
The very first thing you need to do is to check that it works in isolation.
If you cant start it from the commandline then ZAP has no chance of doing so...

Hammad Ali

unread,
Aug 16, 2023, 4:10:45 AM8/16/23
to zaprox...@googlegroups.com
Sure thanks I will check it out and update you.

Hammad Ali

unread,
Aug 16, 2023, 8:07:02 AM8/16/23
to ZAP User Group
Is there a way we could set flags for chrome driver I see python zapv2 start it like this, maybe via selenium chromeOptions?
Command: [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: true, browserName: chrome, goog:chromeOptions: {args: [--proxy-bypass-list=<-loopb..., --ignore-certificate-errors, --headless=new], binary: /usr/bin/google-chrome, extensions: []}, proxy: Proxy(manual, http=127.0.0....}]}]

psiinon

unread,
Aug 16, 2023, 8:23:18 AM8/16/23
to zaprox...@googlegroups.com
Not at the moment.
Have you confirmed Chrome starts from the command line?
What command line options do you need to add?

Cheers,

Simon



--
ZAP Project leader

Hammad Ali

unread,
Aug 16, 2023, 8:44:26 AM8/16/23
to ZAP User Group
Had some issues on building image on M1, in progress. Just want to start chrome headless mode. Like given below
google-chrome \
--no-first-run \
--no-default-browser-check \
--no-sandbox \
--disable-gpu \
--headless \
--mute-audio \
--hide-scrollbars \
--no-zygot

Just curious about this unknown error: DevToolsActivePort file doesn't exist
Reply all
Reply to author
Forward
0 new messages