user-agent

How to change user agent for Firefox webdriver in Python?

两盒软妹~` 提交于 2020-12-06 15:55:11
问题 I'm building a search bot and i want it to change from Desktop to Mobile I tried to use profile.set_preferences but for some reason it wont change. It doesn't give compiling time error but it wont change the user agent. I also tried setting the desired capabilities but that didn't work either. if count == 0: browser = webdriver.Firefox(executable_path="geckodriver.exe") else: profile = webdriver.FirefoxProfile() profile.set_preference("general.useragent.override", "Mozilla/5.0 (Android 4.4;