0 votes
1 view
in Devops and Agile by (18.3k points)

I want to test a web app written in .NET with different agents (iPhone, iPad, Android), I'm using NUnit for the tests and Selenium.

Anyone has a sample to change the agent (for example for iPad or iPhone) in Selenium with c# or VB?

1 Answer

0 votes
by (48.8k points)

I have the C# code using Chrome webdriver:

ChromeOptions options = new ChromeOptions();

options.AddArgument("--user-agent=Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25");

IWebDriver driver = new ChromeDriver(options);

I hope this helps!

...