请看下面的代码( pdf是嵌入到网站),我必须下载使用我的selenium脚本。
<embed width="100%" height="100%" name="plugin" id="plugin" src="http://somewebsite/tulip.pdf" type="application/pdf" internalinstanceid="68" title="">
在上面的html标题=“空”中,但是当我在嵌入式pdf下载图标上悬停时,这个值会更改为title=“下载”。如何使用selenium自动更改此值并下载pdf。Fyi我正在使用谷歌铬,不能直接下载pdf。
发布于 2017-02-07 19:11:11
以某种方式访问下载图标
WebElement downloadIcon = driver.findElement(By.tagName("embed"));
提取PDF文件的地址:
String fileAddress = downloadIcon.getAttribute("src");
然后:
driver.get(fileAddress);
https://stackoverflow.com/questions/42097828
复制相似问题