How to login a website using chromedriver with multiple pfx certificate installed

737 views
Skip to first unread message

manvi saxena

unread,
Feb 7, 2018, 10:17:45 PM2/7/18
to Selenium Users

I have multiple pfx certificate (personal information exchange) installed on my system. When I have to login with chrome, I just choose which cert to choose in (Windows Security) pop up window that says select a certificate. How can I achieve this(choosing a certificate) functionality in selenium chrome driver.

Three ways that I came across while searching are


1) creating a different profile for every cert (which is not scalable if I have 1000s of cert on production server.) 


2) Using PhantomJS Web browser implementation:

For which I am doing:

DesiredCapabilities cap = DesiredCapabilities.chrome();
ImmutableMap<String, String> commandLineArguments = ImmutableMap.<String, String>builder()
        .put("web-security", "false")
        .put("ssl-protocol", "any")
        .put("ignore-ssl-errors", "true")
        .put("webdriver-loglevel", "DEBUG")
        .put("ssl-client-certificate-file", certificatePath)
        .put("ssl-client-key-passphrase", certificatePassword)
        .build();
String[] params = commandLineArguments.entrySet().stream()
        .map(e -> String.format("--%s=%s", e.getKey(), e.getValue()))
        .collect(Collectors.toList())
        .toArray(new String[0]);

cap.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS, params);
cap.setCapability(ChromeOptions.CAPABILITY, options);
WebDriver driver = new PhantomJSDriver(cap);
driver.get(Url);

But it is giving me blank page. I suspect, I am using "ssl-client-key-passphrase" for Personal information exchange file that states "password".. How can I specify password on chrome capabilities.? 


3) Adding registry setting like below and restarted system. enter image description here


But Nothing is working for me..

 

Any help regarding this is highly appreciated..

Serguei Kouzmine

unread,
Feb 17, 2018, 5:33:50 PM2/17/18
to Selenium Users
Please elaborate the goals of  test case that would require all 1000s of certs  at once... 
Reply all
Reply to author
Forward
0 new messages