python selenium Chrome 设置为手机模式

时间:2018-02-06 19:23:29   收藏:0   阅读:698

# -*- coding: utf-8 -*-

from selenium import webdriver

from time import sleep

mobileEmulation = {‘deviceName‘: ‘Apple iPhone 4‘} options = webdriver.ChromeOptions()

options.add_experimental_option(‘mobileEmulation‘, mobileEmulation)

driver = webdriver.Chrome(executable_path=‘chromedriver.exe‘, chrome_options=options)

driver.get(‘http://m.baidu.com‘)

sleep(3)

driver.close()

原文:https://www.cnblogs.com/chukun/p/8423367.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!