Selenium(Python)驱动手机Chrome浏览器,,ChromeAppT
Selenium(Python)驱动手机Chrome浏览器,,ChromeAppT
ChromeAppTest.py:
import unittest
from time import sleep
from appium import webdriver
class MyTestCase(unittest.TestCase):
def setUp(self):
capabilities = {
"platformName": "Android",
# Mobile OS类型
"platformVersion": "7.1.1",
# Mobile OS版本
"deviceName": "3216e430",
# adb devices
"browserName": "Chrome",
# Chrome浏览器
"appPackage": "com.android.browser",
# Chrome的包名
"appActivity": ".BrowserActivity",
# Chrome的启动页
"unicodeKeyboard": True,
# 支持中文输入,默认false
"resetKeyboard": True,
# 重置输入法为系统默认
"noReset": True,
# 不重新安装apk
"noSign": True
# 不重新签名apk
}
self.driver = webdriver.Remote("http://localhost:4723/wd/hub", capabilities)
sleep(1)
def test_chromeApp(self):
url = "https://m.taobao.com"
# 手机淘宝H5
driver = self.driver
driver.get(url)
sleep(1)
driver.find_element_by_id("search-placeholder").click()
# 点击淘宝搜索框
sleep(1)
driver.find_element_by_name("q").send_keys("华硕官方旗舰店")
sleep(1)
driver.find_element_by_class_name("icons-search").click()
sleep(3)
assert driver.page_source.__contains__("asus华硕官方旗舰店")
def tearDown(self):
self.driver.close_app()
self.driver.quit()
if __name__ == ‘__main__‘:
unittest.main()
Selenium(Python)驱动手机Chrome浏览器
相关内容
- python 识别图像主题并切割,python图像,两种办法,一种
- python +djanjo 开发,pythondjanjo开发,1、安装好pytho
- python -ddt重写,,ddt原始框架,生成
- Python实现排序算法1,python排序算法,排序算法有很多种
- Python 字符串的方法,Python字符串方法,Python字符串的
- 可以从哪里入手Python编程 怎么专业学习Python,python专业
- Python基础教程(第三版)(六) 抽象,python基础教程
- python+opencv读取视频,调用摄像头,,引用import c
- python-商品管理小程序,,#需求:1、添加商品
- python-数据结构代码 图(邻接表),,class Vert
评论关闭