欢迎关注微信公众号交流:
零基础学自动化测试
《接口测试自动化实战》--接口自动化书籍
https://yuedu.baidu.com/ebook/aaf72f1b42323968011ca300a6c30c225901f07d
欢迎阅读
Python - selenium自动化-Chrome(wap模式)
上一篇 /
下一篇 2018-01-11 13:57:54
- 打开谷歌浏览器,按F12,进入开发者模式,点击Toggle device toolbar,进入手机模式
deviceName可更改成Chrome浏览器中支持的设备型号
- 设置成手机模式之后,使用click事件,进行搜索,无响应,我们可以使用TouchActions中tap方式去处理
- TouchActions具体可参看源码
示例代码:
# -*- coding:utf-8 -*-
fromseleniumimportwebdriver
fromselenium.webdriver.common.touch_actionsimportTouchActions
mobile_emulation = {"deviceName":"Galaxy S5"}
option = webdriver.ChromeOptions()
option.add_experimental_option('mobileEmulation',mobile_emulation)
driver = webdriver.Chrome(chrome_options=option)
driver.get('https://www.baidu.com')
print('打开浏览器')
print(driver.title)
driver.find_element_by_id('index-kw').send_keys('测试') # driver.find_element_by_id("index-bn").click()
el = driver.find_element_by_id("index-bn")
TouchActions(driver).tap(el).perform()
print('关闭')
driver.quit()
print('测试完成')
Miss_love
《接口测试自动化实战》-接口测试书籍
https://yuedu.baidu.com/ebook/aaf72f1b42323968011ca300a6c30c225901f07d
标题搜索
日历
|
日 |
一 |
二 |
三 |
四 |
五 |
六 |
| | | | | 1 | 2 |
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 | | | | | | |
数据统计
- 访问量: 24793
- 日志数: 24
- 图片数: 1
- 建立时间: 2017-09-11
- 更新时间: 2019-12-04