Code:
EdgeOptions edgeoptions = new EdgeOptions();
edgeoptions.addArguments("--remote-debugging-port=14837");
edgeoptions.addArguments("--start-maximized");
edgeoptions.addArguments("user-data-dir=C:\\Users\\jagadish\\AppData\\Local\\Microsoft\\Edge\\User Data");
edgeoptions.addArguments("profile-directory=Profile 2");
WebDriver driver = new EdgeDriver(edgeoptions);
Error:
Microsoft Edge WebDriver was started successfully.
Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: unknown error: 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.)
Host info: host: 'JAGADISH-LAPTOP', ip: '192.168.1.105'
Build info: version: '4.7.2', revision: '4d4020c3b7'
System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.1'
Driver info: org.openqa.selenium.edge.EdgeDriver
Command: [null, newSession {capabilities=[Capabilities {browserName: MicrosoftEdge, ms:edgeOptions: {args: [--remote-debugging-port=14837, --start-maximized, user-data-dir=C:\Users\jaga..., profile-directory=Profile 2], extensions: []}}], desiredCapabilities=Capabilities {browserName: MicrosoftEdge, ms:edgeOptions: {args: [--remote-debugging-port=14837, --start-maximized, user-data-dir=C:\Users\jaga..., profile-directory=Profile 2], extensions: []}}}]
test is running without switching the profile. Then i want to switch my profile and added the edge options, driver launched but throwed error "devtoolsactiveport file doesn't exist edge selenium".
found solution in https://stackoverflow.com/questions/66682566/ms-edge-driver-error-devtoolsactiveport-file-doesnt-exist-works-only-with and added --remote-debugging-port=14837. now i am facing chrome not reachable error.