Back

Explore Courses Blog Tutorials Interview Questions
0 votes
3 views
in DevOps and Agile by (19.7k 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 (62.9k 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!

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s online Selenium certification!

Browse Categories

...