Reputation: 27
Please look at the code below ( The pdf is embed in the website) I have to download using my selenium script.
<embed width="100%" height="100%" name="plugin" id="plugin" src="http://somewebsite/tulip.pdf" type="application/pdf" internalinstanceid="68" title="">
In the above html title = "" empty but when i hover on the embedded pdf download icon this value changes to title="Download" . How to use selenium to change this value automatically and download the pdf. Fyi I am using google chrome and unable to directly download pdf.
Upvotes: 1
Views: 3883
Reputation: 4586
Get access to the download icon somehow:
WebElement downloadIcon = driver.findElement(By.tagName("embed"));
Extract the address of the PDF file:
String fileAddress = downloadIcon.getAttribute("src");
and then:
driver.get(fileAddress);
Upvotes: 3