Appium -作业5(2)

# coding:utf-8

from appium import webdriver
import time
desired_caps = {
'platformName':'Android',
'deviceName':'test',
'platformVersion':'4.4.4',
'appPackage':'com.example.jcy.wvtest',
'appActivity':'com.example.jcy.wvtest.MainActivity',
'noReset':True,
'unicodeKeyboard':True,
'resetKeyboard':True
}
driver = webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)
contexts = driver.contexts
driver.switch_to.context(contexts[1])
print driver.current_context
time.sleep(2)
ele = driver.find_element_by_id('index-kw')
time.sleep(2)
ele.send_keys(u'松勤')
driver.find_element_by_class_name('newHisBtn').click()
driver.find_element_by_id('index-bn').click()
time.sleep(1)
print driver.find_element_by_class_name('c-title-text').text
driver.switch_to.context(contexts[0])
driver.open_notifications()
time.sleep(2)
driver.press_keycode(3)
posted @ 2019-04-13 22:36  午间小憩  阅读(75)  评论(0编辑  收藏  举报