Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select client certificate for authorization in Chrome headless mode

I'm trying to run tests in headless Chrome using Geb. Before enter the page, I have to select client certificate for authentication. How to do this in headless mode?

Robot class not working without UI.

Is there any way to handle certificate selection? I read about policies and AutoSelectCertificateForUrls but I can't find way to load policy from file or set this particular parameter as option/argument (Chrome on Linux).

In PhantomJS there is option to provide certificate as argument but how to do this using Chrome driver?

like image 790
caterso Avatar asked Nov 07 '22 17:11

caterso


1 Answers

I had the same problem and ended up running in headful mode instead. There are some stuff required to be installed on the server though to be able to run Selenium in headful mode. I wrote an article on the subject using Selenium with .NET Core in linux with environment setup through docker.

https://sgedda.medium.com/running-selenium-with-chromedriver-together-with-client-certificate-set-in-headful-mode-with-net-a79bde19e472

Dockerfile https://gist.githubusercontent.com/sgedda/584aa35a0d9162ad24f9cca836266959/raw/1fc0b4e6e8c76b791437bc847b67b2ed676c5d9b/Dockerfile

like image 125
Sgedda Avatar answered Nov 15 '22 13:11

Sgedda