Creating a map to set Edge preferences

Map<String, Object> edgePrefs = new HashMap<String, Object>(); edgePrefs.put("profile.default_content_settings.popups", 0); edgePrefs.put("profile.default_content_setting_values.notifications", 2); edgePrefs.put("download.default_directory", file1); edgePrefs.put("profile.default_content_setting_values.automatic_downloads", 1); edgePrefs.put("download.prompt_for_download", false);

// Creating EdgeOptions and setting experimental options

EdgeOptions options = new EdgeOptions(); options.setExperimentalOption("prefs", edgePrefs);

// Adding command line arguments

options.addArguments("start-maximized"); // open Browser in maximized mode options.addArguments("disable-infobars"); // disabling infobars options.addArguments("--disable-extensions"); // disabling extensions options.addArguments("--disable-gpu"); // applicable to Windows OS only options.addArguments("--disable-dev-shm-usage"); // overcome limited resource problems options.addArguments("--no-sandbox"); options.addArguments("--remote-debugging-port=5557");

// Setting a capability to accept insecure certificates

options.setCapability(CapabilityType.ACCEPT_INSECURE_CERTS, true);

// Setting up the EdgeDriver using WebDriverManager

WebDriverManager.edgedriver().setup(); WebDriver driver = new EdgeDriver(options);

Error log: Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: Microsoft Edge failed to start: exited normally. (chrome not reachable) (The process started from msedge location C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe is no longer running, so msedgedriver is assuming that msedge has crashed.)

OS -Windows 11 Java -14 Selenium 4.11 Edge version 120

I tried using selenium version 3.141.0 still facing the same issue

Any solution would be appreciated.Thank you!

0

There are 0 best solutions below