其他分享
首页 > 其他分享> > Selenium 用chrome的Mobile emulation模拟手机

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()

标签:webdriver,模拟手机,chrome,mobileEmulation,driver,Mobile,sleep,mobile,options
来源: https://www.cnblogs.com/TD1900/p/13030765.html