Selenium PageFactory deprecated for .NET Core

See alternate implementation here.

blocking urls in selenium

Sometimes we want to block specific URLs from loading, for example Google Analytics so we don’t artificially inflate our statistics.

readonly string[] _blockUrls = new [] {

public ChromeDriver GetDriver() 
    var options = new ChromeOptions();
    var rules = string.Join(',', _blockUrls.Select(r => $"MAP {r}"));
    return new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), options);

killing long-running processes

When ChromeDriver fails to gracefully terminate, it can hold the build agent from completing the build until it times out (~2 hours). Use this to murder the process on Assembly Cleanup.

public class Teardown
    static public void AssemblyCleanup()
        foreach (var process in Process.GetProcessesByName("chromedriver"))