Java 有没有办法得到<;嵌入>;SeleniumWebDriver中的标记资源
我正在尝试将pdf嵌入到html文档中。这是参考网站 使用Java 有没有办法得到<;嵌入>;SeleniumWebDriver中的标记资源,java,selenium,selenium-webdriver,selenium-chromedriver,Java,Selenium,Selenium Webdriver,Selenium Chromedriver,我正在尝试将pdf嵌入到html文档中。这是参考网站 使用HTML页面上的标记嵌入pdf文档 我有以下几件事- 如果我打开chrome浏览器(我使用的是Version 55.0.2883.87 m),并检查标签上的元素,或者单击F12,然后检查相同的内容,则会显示标签内容,如下所示- <embed src="chrome-extension://oemmndcbldboiebfnladdacbdfmadadm/content/web/viewer.html?file=https%3A%2F
HTML
页面上的
标记嵌入pdf文档
我有以下几件事-
Version 55.0.2883.87 m
),并检查
标签上的元素,或者单击F12
,然后检查相同的内容,则会显示标签内容,如下所示-
<embed src="chrome-extension://oemmndcbldboiebfnladdacbdfmadadm/content/web/viewer.html?file=https%3A%2F%2Fpdfobject.com%2Fpdf%2Fsample-3pp.pdf#page=2" type="text/html" width="100%" height="100%">
它检索结果为-
<embed width="100%" height="100%" name="plugin" id="plugin" src="https://pdfobject.com/pdf/sample-3pp.pdf#page=2" type="application/pdf" internalinstanceid="9">
相同的快照是相同的-
我这里有几个问题-
chrome
和chromedriver.exe
打开的chrome
检查元件的变化嵌入html
有关如何获取扩展名的crx文件,请参见此处:谢谢回复。你说得对,我的系统中安装了“PDF查看器Chrome extension”。禁用后,它将显示与通过
chromedriver
打开的chrome相同的行为。我是否按预期获得
标记的默认呈现内容。在新打开的开发工具控制台中出现?
<embed width="100%" height="100%" name="plugin" id="plugin" src="https://pdfobject.com/pdf/sample-3pp.pdf#page=2" type="application/pdf" internalinstanceid="9">
<embed id="plugin" type="application/x-google-chrome-pdf" src="https://pdfobject.com/pdf/sample-3pp.pdf#page=2" stream-url="blob:chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/e8337a7a-5af1-456c-8f7a-d8132c67fe6d" headers="Accept-Ranges: bytes
Cache-Control: max-age=2592000
Content-Length: 49672
Content-Type: application/pdf
Date: Wed, 25 Jan 2017 04:51:36 GMT
Expires: Fri, 24 Feb 2017 04:51:36 GMT
Last-Modified: Sat, 19 Mar 2016 06:18:44 GMT
MS-Author-Via: DAV
Server: Apache
X-Content-Type-Options: nosniff
" background-color="0xFF525659" top-toolbar-height="56" top-level-url="https://pdfobject.com/static.html">
ChromeOptions options = new ChromeOptions();
options.addExtensions(new File("/path/to/extension.crx"));
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
ChromeDriver driver = new ChromeDriver(capabilities);