How to use mobile emulation to test on viewports with C# MSTest?

How to use mobile emulation to test on viewports with C# MSTest?

Hi Matthew!

To use mobile emulation to test on viewports with C# MSTest, you can use the below code snippet. It works in Portrait mode.

ChromeOptions chromeCapabilities = new ChromeOptions();         

chromeCapabilities.EnableMobileEmulation("Apple iPhone 6");

ChromeDriverService service = ChromeDriverService.CreateDefaultService(@"C:\chromedriver");            

IWebDriver driver = new ChromeDriver(service, chromeCapabilities);
driver.Navigate().GoToUrl("www.google.com");