Skip to content
Advertisement

How to change selenium user agent in selenium-webdriver nodejs land?

I’m in javascript + mocha + node land.

I have tried setting userAgent and ‘user-agent’ as keys on capabilities:

JavaScript

There is this answer which says to use a firefox profile, but that’s not exposed. There is no driver.FirefoxProfile nor one exposed globally nor webdriver.FirefoxProfile nor driver.profiles etc.

I have tried Googling and looking the source and the documentation but there is nothing on this.

Advertisement

Answer

You cannot do it with Firefox, but you can do it with Chrome. It’s undocumented:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement