Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

C# Sample for automating MS Edge (Chromium) browser using edge web driver

$
0
0

Please follow steps below to create C# MS Edge(Chromium) auto testing program:

(1) Download the specific version of MS Edge (Chromium) WebDriver from link below and store it on desired location.

Download MS Edge (Chromium) web driver

(2) Create a C# Console Application using Visual Studio

(3) Download Selenium C# binding packages using Manage NuGet packages option.

(4) Leverage ChromeDriver() to start the auto test with ChromeOptions identifying MS Edge (Chromium) exe file location

 

Note:

C# Sample code for MS Edge (Chromium) Webdriver.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Edge;
using OpenQA.Selenium.Remote;
using OpenQA.Selenium.Support.UI;

namespace ConsoleApp2 {
	class Program {
		static void Main(string[] args) {
			var anaheimService = ChromeDriverService.CreateDefaultService(@"D:\", "
			msedgedriver.exe "); // user need to pass the driver path here....
            var anaheimOptions = new ChromeOptions
            {
                BinaryLocation = @"
	C: \Program Files(x86)\Microsoft\Edge Dev\Application\msedge.exe "   // user need to pass the location of new edge app here....
            };
            //anaheimOptions.AddArgument("--headless ");
            IWebDriver driver = new ChromeDriver(anaheimService, anaheimOptions);
	driver.Navigate().GoToUrl("
	https: //example.com/");
	Console.WriteLine(driver.Title.ToString());
	driver.Close();
	}
	}
}


Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>