Set UserAgent when running Selenium mobile tests with SafariDriver

1.2k views Asked by At

I want to be able to set UserAgent when running Selenium mobile tests on Safari but I can't figure out how I do that. When I run the same tests on Chrome I can define the UserAgent in my desiredCapabilities like this:

var options = {
    desiredCapabilities: {
        browserName: 'chrome',
        chromeOptions: {
            args: [
                'use-mobile-user-agent',
                'user-agent=Mozilla/5.0 (iPhone; CPU iPhone OS 8_0 like Mac OSX) ...'
            ]
        }
    }
}

Guess there must be a similar way to do it when running it on Safari. I'm using webdriverio to setup my Selenium project but don't think that should matter.

Thanks.

1

There are 1 answers

0
Mattias Farnemyhr On BEST ANSWER

This is not supported by SafariDriver unfortunately. Hope we will see this in the future.