Closed cgpacifico closed 5 years ago
Hi @cgpacifico , this functionality already exists. Please see the ReadMe file located in the following directory for capabilities details: https://github.com/seleniumbase/SeleniumBase/tree/master/examples/capabilities It will show you how to run any test with any user agent on any remote Selenium Grid, such as BrowserStack or Sauce Labs, which gives you the widest range of options for this.
As of seleniumbase v1.21.0, https://github.com/seleniumbase/SeleniumBase/releases/tag/v1.21.0, you can now pass a User-Agent string on the command line when running your tests to fake the User-Agent for the browser.
--agent="USER-AGENT STRING"
Example:
pytest user_agent_test.py --agent="Mozilla/5.0 (Nintendo 3DS; U; ; en) Version/1.7412.EU"
Closing this ticket as resolved!
I would like to be able to set the user agent for a given browser session (in this case, to verify that a mobile user agent receives a different version of the site.)
It is unclear if/how configurations set in browser_launcher could be adjusted on a per-case basis.
If this functionality exists, is it documented somewhere? For future development, a single driver-agnostic method to make this adjustment would be ideal.