zoukankan      html  css  js  c++  java
  • selenium控制浏览器为手机模式

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

      其中Apple iPhone 4为浏览器内支持的手机型号

  • 相关阅读:
    keepalived+httpd 高可用
    网卡绑定配置文件
    elk安装
    mysql数据库
    sed
    kvm
    日常巡检
    haproxy
    (6)PY_(study)
    (5)PY_(study)
  • 原文地址:https://www.cnblogs.com/xqnq2007/p/7921504.html
Copyright © 2011-2022 走看看