w3c / webdriver

Remote control interface that enables introspection and control of user agents.
https://w3c.github.io/webdriver/
Other
679 stars 194 forks source link

Method to change User Agent string #1459

Open noloader opened 4 years ago

noloader commented 4 years ago

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.

eqMFqfFd commented 3 years ago

Will this ever be implemented..