options = webdriver.ChromeOptions()
options.add_argument("--auto-open-devtools-for-tabs")
mobile_emulation = {‘deviceName‘: ‘iPhone 6 Plus‘}
options.add_experimental_option("mobileEmulation", mobile_emulation)
self.browser = webdriver.Chrome(executable_path = ‘C:/Program Files (x86)/Google/Chrome/Application/chromedriver.exe‘, chrome_options = options)
代码实现开发者工具下的手机模式访问
Toggle device toolbar Ctrl+Shift+M