We will use this page as application under test:

http://uitestingplayground.com/shadowdom

The process of digging into Shadow DOM has 3 steps:

1. Find an element in Light DOM

var el = WebDriver.FindElementByXPath("//guid-generator");

2. Switch to Shadow Root

var shadowRoot = WebDriver.ExecuteScript("return arguments[0].shadowRoot;", el.e);

3. Find an element in Shadow DOM

var shadowEl = shadowRoot.FindElementByCssSelector("input");
shadowEl.Click();

Note that only CSS selectors work inside Shadow DOM.

Here is the complete example

WebDriver.ReconnectSession(true);
WebDriver.SetUrl('http://uitestingplayground.com/shadowdom');
var el = WebDriver.FindElementByXPath("//guid-generator");
var shadowRoot = WebDriver.ExecuteScript("return arguments[0].shadowRoot;", el.e);
var shadowEl = shadowRoot.FindElementByCssSelector("input");
shadowEl.Click();