Edge Chromium Automation for MAC and Windows

%3CLINGO-SUB%20id%3D%22lingo-sub-1092888%22%20slang%3D%22en-US%22%3EEdge%20Chromium%20Automation%20for%20MAC%20and%20Windows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1092888%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3ENeed%20help%20regarding%20%3CSTRONG%3EEdge%20chromium%26nbsp%3B%20Beta%20selenium%20java%20automation.%26nbsp%3B%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EUsing%20below%20code%20I%20am%20able%20to%20launch%20Edge%20Chromium%20beta(79.0.309.58)%20in%20%3CSTRONG%3Ewindows%2010%20system.%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-java%22%3E%3CCODE%3Eif(browserName.equals(%22edge%22))%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20System.setProperty(%22webdriver.edge.driver%22%2C%20%22%3CWINDOWSMSEDGECHROMIUMDRIVERPATH%3E%22)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20final%20ChromeOptions%20chromeOptions%20%3D%20new%20ChromeOptions()%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20chromeOptions.setBinary(%22C%3A%5C%5CProgram%20Files%20(x86)%5C%5CMicrosoft%5C%5CEdge%20Beta%5C%5CApplication%5C%5Cmsedge.exe%22)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20chromeOptions.setExperimentalOption(%22useAutomationExtension%22%2C%20false)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20chromeOptions.setExperimentalOption(%22excludeSwitches%22%2C%20Collections.singletonList(%22enable-automation%22))%3B%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20final%20EdgeOptions%20edgeOptions%20%3D%20new%20EdgeOptions().merge(chromeOptions)%3B%20%20%20%20%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20final%20WebDriver%20webDriver%20%3D%20new%20EdgeDriver(edgeOptions)%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20webDriver.manage().window().maximize()%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20webDriver.manage().deleteAllCookies()%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20webDriver.get(url)%3B%0A%20%7D%3C%2FWINDOWSMSEDGECHROMIUMDRIVERPATH%3E%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3BBut%20Using%20the%20below%20code%20I%20am%20facing%20difficulties%20to%20lunch%20Edge%20Chromium%20beta(79.0.309.58)%20in%20%3CSTRONG%3EMAC%3C%2FSTRONG%3E%20%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-java%22%3E%3CCODE%3Eif(browserName.equals(%22edge%22))%20%7B%0ASystem.setProperty(%22webdriver.edge.driver%22%2C%20%22%2FUsers%2FmacUser%2FDocuments%2Fprojects%2FprojectName%2Fdriver%2Fmsedgedriver%22)%3B%0Afinal%20ChromeOptions%20chromeOptions%20%3D%20new%20ChromeOptions()%3B%0AchromeOptions.setBinary(%22%2FApplication%2FMicrosoft%20Edge%20Beta.app%22)%3B%0AchromeOptions.setExperimentalOption(%22useAutomationExtension%22%2C%20false)%3B%0AchromeOptions.setExperimentalOption(%22excludeSwitches%22%2C%20Collections.singletonList(%22enable-automation%22))%3B%0Afinal%20EdgeOptions%20edgeOptions%20%3D%20new%20EdgeOptions().merge(chromeOptions)%3B%0Afinal%20WebDriver%20webDriver%20%3D%20new%20EdgeDriver(edgeOptions)%0AwebDriver.manage().window().maximize()%3B%0AwebDriver.manage().deleteAllCookies()%3B%0AwebDriver.get(url)%3B%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23000000%22%3E%3CFONT%3EIn%20below%20line%26nbsp%3B%3C%2FFONT%3E%3C%2FFONT%3E%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-java%22%3E%3CCODE%3Efinal%20EdgeOptions%20edgeOptions%20%3D%20new%20EdgeOptions().merge(chromeOptions)%3B%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%3CFONT%20color%3D%22%23000000%22%3Egetting%26nbsp%3Bbelow%20error%26nbsp%3B%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-java%22%3E%3CCODE%3Ecan%20not%20resolve%20merge(org.openqa.selenium.chrome.ChromeOptions)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23008000%22%3E%26nbsp%3B%3C%2FFONT%3E%3CFONT%20color%3D%22%23000000%22%3Ein%20mac%20o.s%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23000000%22%3EBut%20if%20I%20use%3C%2FFONT%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-java%22%3E%3CCODE%3E%20%20%20%20%20%20%20%20%20%20%20%20final%20EdgeOptions%20edgeOptions%20%3D%20new%20EdgeOptions()%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CFONT%20color%3D%22%23000000%22%3Einstead%20of%26nbsp%3B%3CBR%20%2F%3E%3C%2FFONT%3E%3C%2FP%3E%3CPRE%3E%3CSPAN%3Efinal%20%3C%2FSPAN%3E%3CSPAN%3EEdgeOptions%20edgeOptions%20%3C%2FSPAN%3E%3D%20%3CSPAN%3Enew%20%3C%2FSPAN%3EEdgeOptions().merge(%3CSPAN%3EchromeOptions%3C%2FSPAN%3E)%3CSPAN%3E%3B%20%3C%2FSPAN%3E%3CSPAN%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3Ethen%20In%20MAC%20O.S%20getting%20below%20Exception%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-java%22%3E%3CCODE%3Eorg.openqa.selenium.WebDriverException%3A%20unknown%20error%3A%20cannot%20find%20Microsoft%20Edge%20binary%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20any%20one%20help%20me%20regarding%20thing.%3C%2FP%3E%3CP%3EThanks!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1092888%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EEdgeChromiumAutomation%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1093146%22%20slang%3D%22en-US%22%3ERe%3A%20Edge%20Chromium%20Automation%20for%20MAC%20and%20Windows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1093146%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F508137%22%20target%3D%22_blank%22%3E%40panirban%3C%2FA%3E%2C%26nbsp%3Btwo%20things%20jump%20out%20immediately%2C%20so%20can%20you%20check%20these%20just%20to%20make%20sure%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20path%20to%20msedge%20needs%20to%20be%20the%20full%20path%2C%20can%20you%20please%20make%20sure%20you%20use%20this%3A%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%E2%80%9C%2FApplications%2FMicrosoft%20Edge%20Beta%20.app%2FContents%2FMacOS%2FMicrosoft%20Edge%20Beta%22%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3Eand%20also%2C%20note%20that%20it%20should%20be%20Applications%2C%20not%20Application%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ELet%20us%20know%20if%20that%20works.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E-John%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1093603%22%20slang%3D%22en-US%22%3ERe%3A%20Edge%20Chromium%20Automation%20for%20MAC%20and%20Windows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1093603%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F318459%22%20target%3D%22_blank%22%3E%40johnjansen%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EAfter%20changing%20binary%20path%20to%26nbsp%3B%3C%2FP%3E%3CPRE%3E%3CSPAN%3EchromeOptions%3C%2FSPAN%3E.setBinary(%3CSPAN%3E%22%2FApplications%2FMicrosoft%20Edge%20Beta.app%2FContents%2FMacOS%2FMicrosoft%20Edge%20Beta%22%3C%2FSPAN%3E)%3CSPAN%3E%3B%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FPRE%3E%3CP%3Estill%20it%20didn't%20worked.%20Same%20error%20getting%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1094314%22%20slang%3D%22en-US%22%3ERe%3A%20Edge%20Chromium%20Automation%20for%20MAC%20and%20Windows%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1094314%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F318459%22%20target%3D%22_blank%22%3E%40johnjansen%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHi%2C%20its%20working%20after%20the%20using%20full%20path%20as%20per%20your%20suggestion.%20We%20need%20to%20use%20latest%20selenium%20-%20server.%3C%2FP%3E%3CP%3EI%20was%20using%20old%20selenium-%20server%20for%20MAC%20thats%20why%20earlier%20it%20was%20failing.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20your%20help%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

Hi,

Need help regarding Edge chromium  Beta selenium java automation. 

Using below code I am able to launch Edge Chromium beta(79.0.309.58) in windows 10 system.

 

 

if(browserName.equals("edge")){
            System.setProperty("webdriver.edge.driver", "<windowsMsEdgeChromiumDriverPath>");
            final ChromeOptions chromeOptions = new ChromeOptions();
            chromeOptions.setBinary("C:\\Program Files (x86)\\Microsoft\\Edge Beta\\Application\\msedge.exe");
            chromeOptions.setExperimentalOption("useAutomationExtension", false);
            chromeOptions.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));            
            final EdgeOptions edgeOptions = new EdgeOptions().merge(chromeOptions);            
            final WebDriver webDriver = new EdgeDriver(edgeOptions);
            webDriver.manage().window().maximize();
            webDriver.manage().deleteAllCookies();
            webDriver.get(url);
	}

 

 

 But Using the below code I am facing difficulties to lunch Edge Chromium beta(79.0.309.58) in MAC

 

 

if(browserName.equals("edge")) {
System.setProperty("webdriver.edge.driver", "/Users/macUser/Documents/projects/projectName/driver/msedgedriver");
final ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setBinary("/Application/Microsoft Edge Beta.app");
chromeOptions.setExperimentalOption("useAutomationExtension", false);
chromeOptions.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));
final EdgeOptions edgeOptions = new EdgeOptions().merge(chromeOptions);
final WebDriver webDriver = new EdgeDriver(edgeOptions)
webDriver.manage().window().maximize();
webDriver.manage().deleteAllCookies();
webDriver.get(url);
}

 

 

In below line 

final EdgeOptions edgeOptions = new EdgeOptions().merge(chromeOptions);

getting below error 

 

can not resolve merge(org.openqa.selenium.chrome.ChromeOptions)

 

 in mac o.s

 

But if I use

 

            final EdgeOptions edgeOptions = new EdgeOptions()

 

instead of 

final EdgeOptions edgeOptions = new EdgeOptions().merge(chromeOptions); 

then In MAC O.S getting below Exception

 

org.openqa.selenium.WebDriverException: unknown error: cannot find Microsoft Edge binary

 

 

Can any one help me regarding thing.

Thanks!

3 Replies
Highlighted

Hi @panirban, two things jump out immediately, so can you check these just to make sure?

 

The path to msedge needs to be the full path, can you please make sure you use this:

 

“/Applications/Microsoft Edge Beta .app/Contents/MacOS/Microsoft Edge Beta"

 

and also, note that it should be Applications, not Application

 

Let us know if that works.

 

-John

Highlighted

@johnjansen 

Hi,

After changing binary path to 

chromeOptions.setBinary("/Applications/Microsoft Edge Beta.app/Contents/MacOS/Microsoft Edge Beta");

still it didn't worked. Same error getting

Highlighted

@johnjansen

 

Hi, its working after the using full path as per your suggestion. We need to use latest selenium - server.

I was using old selenium- server for MAC thats why earlier it was failing.

 

Thanks for your help