Java Selenium Programs & Concepts:

 Refer to this page to have good diving into basics and advanced logical programs used in automating various web pages. 

The index are:

1. Using ChromeOptions: To make in use chrome to config download desired folder.





1. Using ChromeOptions: To make in use chrome to config download desired folder.

 (This will also not show the Deprecated message as we know that DesiredCapabilities now not in use)


String fileNewPath = "C:/User/Documents/Test"; 

String filePath = fileNewPath.replace('/', '\\');


Map<String, Object> chromePrefs = new HashMap<String, Object>();

chromePrefs.put("profile.default_content_settings.popups", 0);

chromePrefs.put("download.default_directory", filePath);

chromePrefs.put("download.prompt_for_download", false);

chromePrefs.put("plugins.plugins_disabled", "Chrome PDF Viewer");


ChromeDriverService service =

              new ChromeDriverService.Builder().usingDriverExecutable(new File(".//driver/chromedriver.exe")).usingAnyFreePort().build();


ChromeOptions options = new ChromeOptions();

options.setExperimentalOption("prefs", chromePrefs);

DesiredCapabilities cap = DesiredCapabilities.chrome();

options.merge(cap);


ChromeDriver driver = new ChromeDriver(service, options);

driver.get("<< URL >>");

Comments

Popular posts from this blog

The self healing automation framework - Healenium Updated Dec2023

Heleanium - Web without using Docker