device name确定手机样式
from selenium import webdriver
from time import sleep
mobileEmulation = {‘deviceName‘: ‘iPhone 6/7/8 Plus‘}
options = webdriver.ChromeOptions()
options.add_experimental_option(‘mobileEmulation‘, mobileEmulation)
mobile_driver = webdriver.Chrome(executable_path=‘chromedriver.exe‘, chrome_options=options)
mobile_driver.get(‘http://m.baidu.com‘)
print(‘iphone_mobile_driver‘)
sleep(3)
mobile_driver.close()