I would like to download file in excel with selenium edge web driver in specific custom folder in java selenium?

Saikat Das 0 Reputation points
2024-12-20T10:04:05.2966667+00:00

HashMap<String, Object> edgePrefs = new HashMap<>(); edgePrefs.put("download.default_directory", System.getProperty("user.dir") + "\Download-Files"); edgePrefs.put("profile.default_content_settings.popups", 0); edgePrefs.put("profile.default_content_setting_values.automatic_downloads", 1); // Set EdgeOptions EdgeOptions options = new EdgeOptions();

options.setExperimentalOption("prefs", edgePrefs);

I have tried this way, but setExperimentalOption shows error: The method setExperimentalOption(String, HashMap<String,Object>) is undefined for the type EdgeOptions

Microsoft Edge
Microsoft Edge
A Microsoft cross-platform web browser that provides privacy, learning, and accessibility tools.
2,400 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ShiJieLi-MSFT 11,021 Reputation points Microsoft Vendor
    2024-12-23T02:08:52.0533333+00:00

    Hi @Saikat Das,

    Please note you may not be using the latest version of Java Selenium. Please install the latest version in the official download page. In Selenium 4, setExperimentalOption should be defined as expected.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards,

    Shijie Li


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.