Reputation: 1
I want to save the Webpage content as pdf, so when I'm trying to use the below code
((JavascriptExecutor)DriverHolder.getDriver()).executeScript("window.print=function(){};");
DriverHolder.getDriver().findElement(By.xpath("//button[@onclick=\"window.print()\"]")).click();
"Save As pdf" pop up is appearing, is there any way to save the pdf?
Upvotes: 0
Views: 442
Reputation: 27
just get that save button element and click it will get saved see how
In my case it is
//*[@id="sidebar"]//print-preview-button-strip//div/cr-button[2]/text()
Upvotes: 1