2

How do I, using Selenium (Python), change the UAS (User Agent String) on a webdriver.Chrome() Instance?

I do automated tests, and use more than just Firefox. With firefox my quest is simple, but to get the same result on Chrome, i am at a loss.

NanoMage
  • 121
  • 7
  • If you found the answer useful, it is good practice to close the question. This is either by selecting the green check mark by the answer or, if you used part of the answer to come to a different conclusion, posting your own answer and selecting the green check mark. If you have any other questions, please let me know. – bagelmakers Feb 23 '15 at 21:04

1 Answers1

1

It may be possible to change the UAS using ChromeOptionsfor your chrome implementation. As referenced from this example of chrome options, and this example of implementing a UAS in chrome (granted it is in C#):

from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
chrome_options.add_argument("--user-agent=" + givenUAS)
driver = webdriver.Chrome(chrome_options=chrome_options)

I hope this helps.

Community
  • 1
  • 1
bagelmakers
  • 384
  • 2
  • 15
  • Very much so, thanks. I believe i need to investigate the options from chrome to see what else i can manipulate. Thanks! – NanoMage Feb 26 '15 at 18:58