新版Chrome浏览器不包括- mine type - application/pdf(当通过量角器运行时),这将允许我在浏览器上查看pdf并通过量角器测试url,但它会自动下载并关闭选项卡。如果你手动打开chrome并点击链接,它会在下一个标签中打开pdf,而不会自动下载。
手动运行chrome有以下扩展名::
Chrome PDF Viewer (2 files)
Name: Chrome PDF Viewer
Version:
**Location: chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/
Type: BROWSER PLUGIN
Disable
MIME types:
MIME type Description File extensions
application/pdf
.pdf**
Name: Chrome PDF Viewer
Description: Portable Document Format
Version:
Location: internal-pdf-viewer
Type: PPAPI (out-of-process)
Disable
MIME types:
MIME type Description File extensions
application/x-google-chrome-pdf Portable Document Format
.pdf
Disable Always allowed to run
Chrome自动化扩展-由Protractor运行(MIME类型-这里缺少application/pdf扩展,允许浏览器在浏览器上查看pdf在chrome自动扩展上通过量角器直接连接浏览器运行)
Chrome PDF Viewer
Portable Document Format
Name: Chrome PDF Viewer
Description: Portable Document Format
Version:
Location: internal-pdf-viewer
Type: PPAPI (out-of-process)
Disable
MIME types:
MIME type Description File extensions
application/x-google-chrome-pdf Portable Document Format
.pdf
Disable Always allowed to run
在chrome上有一个类似的问题,但还没有解决方案: https://productforums.google.com/forum/#!主题/铬/A3XrBbHD80U
如果您不关心测试运行时的警告消息,那么这应该可以工作:
"desiredCapabilities": {
"chromeOptions": {
"excludeSwitches": [ "test-type" ]
}
}