def __init__(self): os.popen( 'adb shell am start -n com.kinstalk.notepad/.activity.MainActivity' ) os.popen('adb shell input keyevent 3') os.popen('adb shell input keyevent 3') self.element = test.Element() a = self.element.Network() assert a is True, "Network in not valid"
def addContacts(self): element = test.Element() os.popen('adb shell input tap 515 58') element.waitForElement("resource-id","com.kinstalk.remotecontact:id/tv_number_1","Click to add") print "Typing the number" element.waitForElement("resource-id",'com.kinstalk.remotecontact:id/tv_invite',"Next step") os.popen('adb shell input swipe 500 500 800 800') print "Done with the swipe" element.waitForElement("resource-id",'com.kinstalk.remotecontact:id/handwrite_ok',"Click ok") print "Click for OK"
def deletContacts(self,id): element = test.Element() element.waitForElement('resource-id','com.kinstalk.remotecontact:id/item1',"Delete the first contact") print "Entered the Contact Page" element.waitForElement('class','android.widget.Button',"Click the Edit button") print "Entered the Actions Page" element.waitForElement('resource-id','com.kinstalk.remotecontact:id/btn_del_from_list',"click the Delete") print "Entered the Deleting page" os.popen('adb shell input tap 514 515') print 'Click OK for deleting'
def deleteNote(self): element = test.Element() element.waitForElement('resource-id', 'com.kinstalk.notepad:id/show_bottom_delete', "Click to delete") print "Prepare to delete" element.waitForElement('resource-id', 'com.kinstalk.notepad:id/confirm_sure', "Click to confirm") print 'click ok'
def testNotes(self): element = test.Element() temp = element.checkForElement('text', u"暂无便签") assert temp is True, "Double check the notes" self.addNotes() temp = element.checkForElement('text', "1/1") assert temp is True, "Fail to add new note" self.deleteNote() temp = element.checkForElement('text', u"暂无便签") assert temp is True, "Fail to delete note" os.popen('adb shell input keyevent 3')
def addNotes(self): element = test.Element() element.waitForElement('resource-id', 'com.kinstalk.notepad:id/show_top_btn', "Click to write") print "Start to write" os.popen('adb shell input swipe 500 500 800 800') time.sleep(1) os.popen('adb shell input swipe 500 500 800 800') element.waitForElement('resource-id', 'com.kinstalk.notepad:id/handwrite_ok', "Click ok") print "Click ok"
def checkForContacts(self): element = test.Element() judge = element.checkForElement('resource-id','com.kinstalk.remotecontact:id/item2') while(judge): self.deletContacts('com.kinstalk.remotecontact:id/item2') print "Delete Successful" judge = element.checkForElement('resource-id','com.kinstalk.remotecontact:id/item2') print "Only one contact exists" self.addContacts() see = element.checkForElement('resource-id','com.kinstalk.remotecontact:id/item2') if (see == True): print "Add contact Successful" assert see is True, "Fail to add contact" self.deletContacts('com.kinstalk.remotecontact:id/item1') print "Delete the new contact" see = element.checkForElement('resource-id','com.kinstalk.remotecontact:id/item2') if (see == True): print "Add contact Successful" assert see is not True, "Fail to delete contact" os.popen('adb shell input keyevent 3')
def __init__(self): self.wifiName = u'szjy-guest-21' self.wifiPassword = '******' os.popen('adb shell input keyevent 3') os.popen('adb shell am start -n com.android.settings/.Settings') self.element = test.Element() temp = self.element.findElementById('com.android.settings:id/wifi_switch') page = 0 while temp is None: temp = self.element.findElementById('com.android.settings:id/common_settings') if temp is not None: page = 2 break temp = self.element.findElementById('com.android.settings:id/qlove_change_password') if temp is not None: page = 1 break temp = self.element.findElementById('com.android.settings:id/bt_search_stereo') if temp is not None: page = -1 break temp = self.element.findElementById('com.android.settings:id/restore_settings') if temp is not None: page = -2 break temp = self.element.findElementById('com.android.settings:id/device_info_settings') if temp is not None: page = -3 break if page > 0 : for i in range(page): self.element.waitForElement('resource-id','com.android.settings:id/right_arrow',"Fine the wifi page") elif page < 0 : page = abs(page) for i in range(page): self.element.waitForElement('resource-id','com.android.settings:id/left_arrow',"Fine the wifi page") print "Entered page of WIFI" '''self.element.waitForElement('resource-id','com.android.settings:id/wlan_settings')
def __init__(self): os.popen( 'adb shell am start -n com.kinstalk.notepad/.activity.MainActivity' ) element = test.Element()
import tempfile import os import re import time import xml.etree.cElementTree as ET import sys import test c = test.Element() a = c.Network() print a
def __init__(self): os.popen( 'adb shell am start -n com.android.camera2/com.android.camera.CameraLauncher' ) self.element = test.Element()
def __init__(self): os.popen('adb shell am start -n com.kinstalk.netvideo/.MainActivity') self.element = test.Element() a = self.element.Network() assert a is True, "Network in not valid"
def __init__(self): os.popen('adb shell am start -n com.android.settings/.Settings') os.popen( 'adb shell am start -n com.kinstalk.cookielauncher/.CookieLauncher' ) self.element = test.Element()