1import org.openqa.selenium.By;2import org.openqa.selenium.WebDriver;3import org.openqa.selenium.WebElement;4import org.openqa.selenium.chrome.ChromeDriver;5import org.openqa.selenium.chrome.ChromeOptions;6import org.openqa.selenium.remote.RemoteWebDriver;7import org.openqa.selenium.support.events.EventFiringWebDriver;8import java.io.File;9import java.io.IOException;10import java.util.HashMap;11import java.util.Map;12import java.util.concurrent.TimeUnit;13public class Pdf {14 public static void main(String[] args) throws IOException {15 System.setProperty("webdriver.chrome.driver", "C:\\Users\\Admin\\Downloads\\chromedriver_win32\\chromedriver.exe");16 ChromeOptions options = new ChromeOptions();17 Map<String, Object> prefs = new HashMap<String, Object>();18 prefs.put("plugins.always_open_pdf_externally", true);19 prefs.put("download.default_directory", "C:\\Users\\Admin\\Downloads");20 options.setExperimentalOption("prefs", prefs);21 WebDriver driver = new ChromeDriver(options);22 driver.manage().window().maximize();23 driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);24 System.out.println("Title of the page is " + driver.getTitle());25 driver.close();26 }27}28Your name to display (optional):29Your name to display (optional):30public class DownloadFile {31 public static void main(String[] args) {32 System.setProperty("webdriver.chrome.driver", "C:\\Users\\Admin\\Downloads\\chromedriver_win32\\chromedriver.exe");33 ChromeOptions options = new ChromeOptions();34 Map<String, Object> prefs = new HashMap<String, Object>();35 prefs.put("plugins.always_open_pdf_externally", true);36 prefs.put("download.default_directory", "C:\\Users\\Admin\\Downloads");37 options.setExperimentalOption("prefs", prefs);38 WebDriver driver = new ChromeDriver(options);39 driver.manage().window().maximize();