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)

猜你喜欢

转载自www.cnblogs.com/hyzhang/p/10703294.html
今日推荐