selenium 开发者工具 手机模式

options = webdriver.ChromeOptions()

options.add_argument("--auto-open-devtools-for-tabs")

mobile_emulation = {‘deviceName‘: ‘iPhone 6 Plus‘}

options.add_experimental_option("mobileEmulation", mobile_emulation)

self.browser = webdriver.Chrome(executable_path = ‘C:/Program Files (x86)/Google/Chrome/Application/chromedriver.exe‘, chrome_options = options)

 

代码实现开发者工具下的手机模式访问

Toggle device toolbar Ctrl+Shift+M

selenium 开发者工具 手机模式

上一篇:阿里巴巴P7二面:Mybatis接口Mapper内的方法为啥不能重载?我回答后直接拿到offer!


下一篇:启动spring测试报错 Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.2:test (default-test) on project gulimall-coupon: There are test failures. Please refer to D:\m1\0613\mall-coup