from time import sleep
import unittest
from appium import webdriver
class AndroidWebViewTests(unittest.TestCase):
def setUp(self):
app = '/Users/guanhua.jing/appauto/app-btrProduction-debug.apk'
desired_caps = {
'app':app,
'appPackage':'com.beyondtherack.btrandroid',
'appActivity':'com.beyondtherack.btrandroid.activities.MainActivity',
'platformName':'Android',
'platformVersion':'5.0.1',
'deviceName':'G3',
'automationName':'Appium',
'noReset':'false'
}
self.driver = webdriver.Remote('http://172.30.40.92:4723/wd/hub', desired_caps)
sleep(20)
def test_login(self):
self._login()
def test_accept_notification(self):
self._login()
el_notification = self.driver.find_element_by_xpath('//android.widget.Button[@content-desc="OK"]')
el_notification.click()
sleep(15)
def _login(self):
el_email = self.driver.find_element_by_xpath('//android.view.View[3]/android.widget.EditText[1]')
el_email.send_keys('[email protected]')
el_passwd = self.driver.find_element_by_xpath('//android.widget.EditText[contains(@content-desc, "Password")]')
el_passwd.send_keys('autoqa')
el_signin = self.driver.find_element_by_xpath('//android.widget.Button[@content-desc="SIGN IN"]')
el_signin.click()
sleep(15)
def tearDown(self):
self.driver.quit()
if __name__ == '__main__':
loader = unittest.TestLoader()
ln = lambda f: getattr(AndroidWebViewTests, f).im_func.func_code.co_firstlineno
lncmp = lambda a, b: cmp(ln(a), ln(b))
loader.sortTestMethodsUsing = lncmp
unittest.main(testLoader=loader, verbosity=2)
appium_android_apk
猜你喜欢
转载自blog.csdn.net/zljain/article/details/81628966
今日推荐
周排行