Мне нужно использовать сертификат (.cer) для подключения к веб-сайту. Я использую PhantomJS с Python. Это код подключения:
driver = webdriver.PhantomJS(executable_path="Selenium/bin/phantomjs",
service_args=['--ssl-client-certificate-file=certificate.cer'],
desired_capabilities=dcap)
Однако возвращается HTML:
<html><head></head><body></body></html>
и URL-адрес:
about:blank
Но если я уберу:
'--ssl-client-certificate-file=certificate.cer'
Затем я получаю правильный URL-адрес и некоторое содержимое HTML (запрещенное сообщение, поскольку сертификат отсутствует).
Есть идеи, что я могу сделать, чтобы решить эту проблему?
ОБНОВЛЕНИЕ 1
Ghostdriver.log содержит следующее:
[INFO - 2018-04-27T15:18:44.680Z] GhostDriver - Main - running on port 55768
[INFO - 2018-04-27T15:18:44.960Z] Session [46addab0-4a2e-11e8-879b-bb8782c84ba6] - page.settings - {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1","webSecurityEnabled":true}
[INFO - 2018-04-27T15:18:44.960Z] Session [46addab0-4a2e-11e8-879b-bb8782c84ba6] - page.customHeaders: - {}
[INFO - 2018-04-27T15:18:44.960Z] Session [46addab0-4a2e-11e8-879b-bb8782c84ba6] - Session.negotiatedCapabilities - {"browserName":"phantomjs","version":"2.1.1","driverName":"ghostdriver","driverVersion":"1.2.0","platform":"mac-unknown-64bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"},"phantomjs.page.settings.javascriptEnabled":true}
[INFO - 2018-04-27T15:18:44.960Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: 46addab0-4a2e-11e8-879b-bb8782c84ba6
[INFO - 2018-04-27T15:19:26.438Z] SessionManagerReqHand - _cleanupWindowlessSessions - Asynchronous Sessions clean-up phase starting NOW
ОБНОВЛЕНИЕ 2 - с помощью logging.getLogger ()
2018-04-30 09:39:56,730 - selenium.webdriver.remote.remote_connection - DEBUG - POST http://127.0.0.1:57672/wd/hub/session {"requiredCapabilities": {}, "desiredCapabilities": {"platform": "ANY", "browserName": "phantomjs", "version": "", "phantomjs.page.settings.javascriptEnabled": true, "javascriptEnabled": true}}
2018-04-30 09:39:56,745 - selenium.webdriver.remote.remote_connection - DEBUG - Finished Request
2018-04-30 09:39:56,745 - selenium.webdriver.remote.remote_connection - DEBUG - POST http://127.0.0.1:57672/wd/hub/session/0f971930-4c52-11e8-8957-cd8a79dc644c/url {"url": "https://idp.iamfas.belgium.be/fasui/login/commercialnoidservice", "sessionId": "0f971930-4c52-11e8-8957-cd8a79dc644c"}
2018-04-30 09:39:56,971 - selenium.webdriver.remote.remote_connection - DEBUG - Finished Request
2018-04-30 09:39:56,971 - selenium.webdriver.remote.remote_connection - DEBUG - GET http://127.0.0.1:57672/wd/hub/session/0f971930-4c52-11e8-8957-cd8a79dc644c/source {"sessionId": "0f971930-4c52-11e8-8957-cd8a79dc644c"}
2018-04-30 09:39:56,974 - selenium.webdriver.remote.remote_connection - DEBUG - Finished Request
HTML FOUND:
<html><head></head><body></body></html>
2018-04-30 09:39:56,974 - selenium.webdriver.remote.remote_connection - DEBUG - GET http://127.0.0.1:57672/wd/hub/session/0f971930-4c52-11e8-8957-cd8a79dc644c/url {"sessionId": "0f971930-4c52-11e8-8957-cd8a79dc644c"}
2018-04-30 09:39:56,980 - selenium.webdriver.remote.remote_connection - DEBUG - Finished Request
URL: about:blank
2018-04-30 09:39:56,980 - selenium.webdriver.remote.remote_connection - DEBUG - POST http://127.0.0.1:57672/wd/hub/session/0f971930-4c52-11e8-8957-cd8a79dc644c/element {"using": "id", "sessionId": "0f971930-4c52-11e8-8957-cd8a79dc644c", "value": "proceedButton"}
2018-04-30 09:39:57,278 - selenium.webdriver.remote.remote_connection - DEBUG - Finished Request