#!/usr/bin/env python
#coding:utf-8
#__author__= andre.yang
from macaca import WebDriver
import time
server_url = {
'hostname': '127.0.0.1',
'port': 3456
}
desired_caps = {
'platformName': 'Android', # iOS, Android.
'deviceName': 'HC46XWY02376',
'platformVersion': '6.0.1',
'reuse': '3',
'package':'com.tencent.mm',
'activity':'com.tencent.mm.ui.LauncherUI'
}
driver = WebDriver(desired_caps,server_url)
driver.init()
time.sleep(2)
driver.element_by_xpath("//*[@text='发现']").click()
time.sleep(2)
driver.element_by_xpath("//*[@text='小程序']").click()
time.sleep(2)
driver.element_by_xpath("//*[@text='京东购物']").click()
driver.save_screenshot('d:/zkk.jpg',True)
time.sleep(5)
driver.quit()