python-appnium

# coding:utf-8
from appium import webdriver
import time
from selenium.webdriver.common.keys import Keys

desired_caps = {'platformName': 'Android',
'deviceName': '30d4e606',
'platformVersion': '6.0',
'appPackage': 'org.zywx.wbpalmstar.widgetone.Mobile.EBS.UAT',
'appActivity': 'org.zywx.wbpalmstar.engine.LoadingActivity'}
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
time.sleep(10)

contexts = driver.contexts
print contexts
driver.switch_to.context(contexts[1])
time.sleep(5)
driver.find_element_by_id('userCode').clear()
driver.find_element_by_id('userCode').send_keys('shenweihuang')
time.sleep(1)
driver.find_element_by_id('passWord').clear()
driver.find_element_by_id('passWord').send_keys('888888a')
time.sleep(1)
driver.find_element_by_xpath(".//*[@id='page_0']/div[2]/div[3]/div").click()
time.sleep(10)
b = driver.current_window_handle
time.sleep(1)
driver.switch_to.window(b)
time.sleep(3)
driver.find_element_by_xpath(".//*[@id='MenuAll']").click()

if __name__ == '__main__':
pass
posted @ 2018-07-28 10:25  忧伤恋上了快乐  阅读(196)  评论(0编辑  收藏  举报