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

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

Hi Matthew!

To use mobile emulation to test on viewports with C# NUnit, 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");