【发布时间】:2020-07-06 18:49:53
【问题描述】:
伙计们,
我在使用 selenium 自动下载 .csr 文件时遇到了一个小问题。
我的网络驱动程序看起来像:
def _set_preferences_for_download(download_dir, profile):
profile.set_preference('browser.download.folderList',
CustomWebdriver.CUSTOM_LOCATION)
profile.set_preference('browser.download.manager.showWhenStarting', False)
profile.set_preference('browser.download.dir', download_dir)
profile.set_preference("browser.helperApps.alwaysAsk.force", False)
profile.set_preference("browser.download.manager.alertOnEXEOpen", False)
profile.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/octet-stream, "
"application/xml, text/xml, "
"text/plain, "
"application/x-java-jnlp-file, "
"application/vnd.ms-excel, "
"application/pkcs8, "
"application/pkcs10, "
"application/pkix-cert, "
"application/pkix-crl, "
"application/pkcs7-mime, "
"application/x-x509-ca-cert, "
"application/x-x509-user-cert, "
"application/x-pkcs7-crl, "
"application/x-pem-file, "
"application/x-pkcs12, "
"application/x-pkcs7-certificates, "
"application/x-pkcs7-certreqresp")
profile.set_preference("browser.download.manager.focusWhenStarting", False)
profile.set_preference("browser.download.useDownloadDir", True)
profile.set_preference("browser.download.manager.closeWhenDone", True)
profile.set_preference("browser.download.manager.showAlertOnComplete", False)
profile.set_preference("browser.download.manager.useWindow", False)
profile.set_preference("services.sync.prefs.sync.browser.download.manager.showWhenStarting", False)
profile.set_preference("pdfjs.disabled", True)
profile.set_preference("accessibility.blockautorefresh", False)
return profile
我仍然面临:
你有什么想法吗?
【问题讨论】:
-
.csr的应用程序类型是什么?检查 devtools 网络选项卡以获取此信息。 -
.csr 是 MIME 之后的证书签名请求,它是
application/pkcs10pki-tutorial.readthedocs.io/en/latest/mime.html -
顺便说一句,您可以在文件名下方找到此信息:
which is: PKCS#10 Certificate Request (928 bytes) -
chrome 默认不会提示...可能需要为此使用 chromedriver。
-
你能添加你的完整代码吗,就像你给的缝一样
标签: python selenium firefox webdriver csr