【发布时间】:2020-11-05 18:22:39
【问题描述】:
我正在构建一个机器人,它将根据我选择的随机用户代理来改变它的外观。我从用户代理列表中提取,根据选择的用户代理,我更改 webdriver 的功能,然后启动它。
但是,我使用https://ipleak.net/ 进行测试,并且无论我运行此代码多少次,我的真实操作系统仍然显示(而不是所谓的欺骗版本)。下面的相关代码,FYI true OS = MacIntel
desired_caps = DesiredCapabilities.CHROME.copy()
desired_caps['platform'] = user_agent_os
browser = webdriver.Chrome(options=options, desired_capabilities=desired_caps)
browser.get("https://ipleak.net/")
user_agent_os = 'ios'、'windows'、'andriod'、'---'、'symbian'、'macos'、'linux' 等的可能值。每次程序运行时,该值都是随机的。
【问题讨论】:
-
我想知道是否可以对标头使用 Selenium-Wire 做一些花哨的事情,但我认为这不会改变 webdriver 的功能。
-
另外我认为标题具有误导性,我想更改
platform中的操作系统信息以匹配user-agent,而不是相反
标签: python-3.x selenium selenium-webdriver selenium-chromedriver user-agent