How to automate chrome user agents

I want to test my application in mobile view, using chrome user agents we can test by manually but using selenium it’s quit difficult

I have found solution at

but am unable to automate if am running script in remote webdriver(selenium grid)

please suggest me …

Note: if possible send code for selenium C#

Default Asked on February 18, 2016 in Selenium WebDriver.
Add Comment
  • 1 Answer(s)

    I got the answer

    var chromeOptions = new Dictionary<string, List<string>>();
    var agents = new List<string> {“–user-agent=” + iphoneUserAgent};
    var caps = DesiredCapabilities.Chrome();
    caps.SetCapability(“chromeOptions”, chromeOptions);
    webDriver = new RemoteWebDriver(new Uri(“hub url “), caps,Timeout);

    Default Answered on February 18, 2016.
    Add Comment
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.