Selenium 用chrome的Mobile emulation模拟手机
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()
今天太阳也东升,而后西沉,早晨盛开的花儿也将凋谢;今天的太阳也西沉,而后东升,阳光照射之处遍地花开,但却已非昨日之花。