0

I have to use existing user login session, we will require EDGE user profile, as we observed EDGE driver doesn't use the existing user data profile it is creating a new profile every time

EDGE Default Profile Path

C:\Users\edge2automation\AppData\Local\Microsoft\Edge\User Data\Default

(Edge driver) path -

C:\Users\edge2automation\AppData\Local\Temp\scoped_dir64860_1277252271\Default

user12974983
  • 13
  • 1
  • 3
  • Could you give more information about your setup? Any errors or logs would be great to ensure we know the full picture. – Jared Feb 27 '20 at 18:39
  • I don't think EdgeDriver includes this functionality. See this page for documentation: https://learn.microsoft.com/en-us/microsoft-edge/webdriver#webdriver-server-command-line-flags – pcalkins Feb 27 '20 at 20:37
  • What do you mean using edge profile? How does it not work? Is there any error or anything else? Which versions of Edge browser and Edge WebDriver are you using? How do you use the selenium webdriver to automate the browser? You should give [a minimal code sample](https://stackoverflow.com/help/minimal-reproducible-example) which you have tried and can reproduce the issue. See [how to ask](https://stackoverflow.com/help/how-to-ask). – Yu Zhou Feb 28 '20 at 05:45
  • Edge - User data (Profile) – user12974983 Mar 02 '20 at 12:37

1 Answers1

3

As the new Edge is based on Chromium, we can refer to the solution of using Chrome profile and change the key words to Edge:

import org.openqa.selenium.WebDriver; 
import org.openqa.selenium.edge.EdgeDriver; 
import org.openqa.selenium.edge.EdgeOptions;


public class Edgeauto {
    public static void main(String[] args) { 
        System.setProperty("webdriver.edge.driver", "your\\path\\to\\edge\\webdriver\\msedgedriver.exe"); 
        EdgeOptions edgeOptions = new EdgeOptions();
        edgeOptions.addArguments("user-data-dir=C:\\Users\\edge2automation\\AppData\\Local\\Microsoft\\Edge\\User Data");
        edgeOptions.addArguments("--start-maximized");
        WebDriver driver = new EdgeDriver(edgeOptions); 
        driver.get("https://www.google.com/");
    }
}

Please note that this needs to use selenium-server-4.0.0-alpha-4 which you can download form here.

Yu Zhou
  • 11,532
  • 1
  • 8
  • 22
  • Thanks a lot!!! it is working as expected just we need to make sure Selenium get proper import with all latest dependencies – user12974983 Mar 04 '20 at 12:28