webdriver icon indicating copy to clipboard operation
webdriver copied to clipboard

Method to change User Agent string

Open noloader opened this issue 6 years ago • 1 comments

I have a pet project similar to Nomorobo. It monitors a phone line and screens calls based on Caller ID. My program also performs a carrier call trace and files FCC and FTC complaints using Python and Selenium.

I would like a way to change the User Agent string when driving the browser for the FCC and FTC complaints. It looks like there are per-browser methods (like here for Chrome), but I don't see a unified way to do it.

I would also like a method to query a User Agent string. I need to do this to preserve most of the existing string. Preserving most of the existing string is important so the remote server (FCC and FTC servers) still recognize the browser.

So putting them together, I would like to do something like this in my software:

driver = webdriver.Chrome(...)
agent = webdriver.get_user_agent()
driver.set_user_agent(agent + " (Callboot Call Manager)")

or

driver = webdriver.Firefox(...)
agent = webdriver.get_user_agent()
driver.set_user_agent(agent + " (Callboot Call Manager)")

Changing the user agent string is a courtesy to the remote system owners, like the FCC and FTC. I also don't want them to think their systems are under attack by unknown ARM devices and possibly reject the complaints that are being filed.

Please consider adding an interface to query and change User Agent strings.

noloader avatar Nov 19 '19 05:11 noloader

Will this ever be implemented..

eqMFqfFd avatar Apr 06 '21 21:04 eqMFqfFd