Tom Smykowski
Tom Smykowski

Reputation: 26089

How to set Safari Selenium WebDriver user agent in Python?

I am creating a Safari WebDriver instance with:

import selenium.webdriver
driver = webdriver.Safari()

Now I'd like to set a custom user agent for the browser. I have noticed that the Safari constructor accepts service_args that selenium service.py file sends further like this:

def command_line_args(self):
        return ["-p", "%s" % self.port] + self.service_args

But there is lack of documentation on how to properly set a user agent for the Safari webdriver in Python. How to set the user agent?

Upvotes: 1

Views: 330

Answers (0)

Related Questions