JustPaste.it

C# Selenium example

using OpenQA.Selenium;
using OpenQA.Selenium.Edge;
using Microsoft.Edge.SeleniumTools;
using EdgeOptions = Microsoft.Edge.SeleniumTools.EdgeOptions;
using System.IO;

namespace selenium_test
{
    class Program
    {     
      
        static void Main(string[] args)
        {
            var options = new EdgeOptions();
            options.UseChromium = true;
            options.BinaryLocation = @"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe";
            options.AddArguments("allow-file-access-from-files"); 
            options.AddArguments("use-fake-device-for-media-stream"); 
            options.AddArguments("use-fake-ui-for-media-stream");
            var driver = new Microsoft.Edge.SeleniumTools.EdgeDriver(@"---<Your Edge driver path here...>---", options);
            driver.Navigate().GoToUrl("----<Your URL will be here...>----");
        }
    }
}