class SoloInterface(): ''' Solo Interface for Automated Testing ''' Android_Class_Name_Dict = { "Button": "android.widget.Button", "CheckBox": "android.widget.CheckBox", "EditText" : "android.widget.EditText", "ImageButton": "android.widget.ImageButton", "ImageVIew": "android.widget.ImageView", "RadioButton": "android.widget.RadioButton", "TextView": "android.widget.TextView", "View": "android.view.View", "ProgressBar": "android.widget.ProgressBar", "ScrollView": "android.widget.ScrollView"} def __init__(self, device_name="emulator-5554", device_port=5554, device_address="127.0.0.1", view_server_port=4939, monkey_server_port=12345): ''' Constructor ''' self.class_name = "SoloInterface" self.m_logger = Logger.InitLog("solo-interface.log", logging.getLogger("solo-interface.thread")) self.device_name = device_name self.device_port = device_port self.device_address = device_address self.view_server_port = view_server_port self.monkey_server_port = monkey_server_port # object of Device self.device = Device(self.m_logger, self.device_name, self.device_port, self.device_address, self.view_server_port, self.monkey_server_port) # init device self.device.open() # build View Tree self.vt = ViewTree(self.m_logger) self.tree_nodes_list = None # object of View Controller self.event_controller = EventController(self.m_logger, self.device_name, self.device_port, self.device_address, self.monkey_server_port) # init event controller self.event_controller.open() try: self.device_display_width = int(self.event_controller.getDisplayWidth()) self.device_display_height = int(self.event_controller.getDisplayHeight()) except Exception, e: print e # to 480*800 display # Notification (y: 0-37 / x: 8-471 ) self.notification_height = 37
def __init__(self, device_name="emulator-5554", device_port=5554, device_address="127.0.0.1", view_server_port=4939, monkey_server_port=12345): ''' Constructor ''' self.class_name = "SoloInterface" self.m_logger = Logger.InitLog("solo-interface.log", logging.getLogger("solo-interface.thread")) self.device_name = device_name self.device_port = device_port self.device_address = device_address self.view_server_port = view_server_port self.monkey_server_port = monkey_server_port # object of Device self.device = Device(self.m_logger, self.device_name, self.device_port, self.device_address, self.view_server_port, self.monkey_server_port) # init device self.device.open() # build View Tree self.vt = ViewTree(self.m_logger) self.tree_nodes_list = None # object of View Controller self.event_controller = EventController(self.m_logger, self.device_name, self.device_port, self.device_address, self.monkey_server_port) # init event controller self.event_controller.open() try: self.device_display_width = int(self.event_controller.getDisplayWidth()) self.device_display_height = int(self.event_controller.getDisplayHeight()) except Exception, e: print e
def __init__( self, device_name="emulator-5554", device_port=5554, device_address="127.0.0.1", view_server_port=4939, monkey_server_port=12345, ): """ Constructor """ self.class_name = "SoloInterface" self.m_logger = Logger.InitLog("solo-interface.log", logging.getLogger("solo-interface.thread")) self.device_name = device_name self.device_port = device_port self.device_address = device_address self.view_server_port = view_server_port self.monkey_server_port = monkey_server_port # object of Device self.device = Device( self.m_logger, self.device_name, self.device_port, self.device_address, self.view_server_port, self.monkey_server_port, ) # init device self.device.open() # build View Tree self.vt = ViewTree(self.m_logger) self.tree_nodes_list = None # object of View Controller self.event_controller = EventController( self.m_logger, self.device_name, self.device_port, self.device_address, self.monkey_server_port ) # init event controller self.event_controller.open() try: self.device_display_width = int(self.event_controller.getDisplayWidth()) self.device_display_height = int(self.event_controller.getDisplayHeight()) # LCD density is in the build.prop: # adb shell getprop ro.sf.lcd_density # And the resolution is availble in the dumpsys of the input activity: # # windows # adb shell dumpsys window | find "DisplayWidth" # # linux # adb shell dumpsys window | grep DisplayWidth except Exception, e: print "Failed to get device display width and height: [%s]" % str(e)
class SoloInterface(): ''' Solo Interface for Automated Testing ''' Android_Class_Name_Dict = { "Button": "android.widget.Button", "CheckBox": "android.widget.CheckBox", "EditText": "android.widget.EditText", "ImageButton": "android.widget.ImageButton", "ImageVIew": "android.widget.ImageView", "RadioButton": "android.widget.RadioButton", "TextView": "android.widget.TextView", "View": "android.view.View", "ProgressBar": "android.widget.ProgressBar", "ScrollView": "android.widget.ScrollView" } def __init__(self, device_name="emulator-5554", device_port=5554, device_address="127.0.0.1", view_server_port=4939, monkey_server_port=12345): ''' Constructor ''' self.class_name = "SoloInterface" self.m_logger = Logger.InitLog( "solo-interface.log", logging.getLogger("solo-interface.thread")) self.device_name = device_name self.device_port = device_port self.device_address = device_address self.view_server_port = view_server_port self.monkey_server_port = monkey_server_port # object of Device self.device = Device(self.m_logger, self.device_name, self.device_port, self.device_address, self.view_server_port, self.monkey_server_port) # init device self.device.open() # build View Tree self.vt = ViewTree(self.m_logger) self.tree_nodes_list = None # object of View Controller self.event_controller = EventController(self.m_logger, self.device_name, self.device_port, self.device_address, self.monkey_server_port) # init event controller self.event_controller.open() try: self.device_display_width = int( self.event_controller.getDisplayWidth()) self.device_display_height = int( self.event_controller.getDisplayHeight()) # LCD density is in the build.prop: # adb shell getprop ro.sf.lcd_density # And the resolution is availble in the dumpsys of the input activity: # # windows # adb shell dumpsys window | find "DisplayWidth" # # linux # adb shell dumpsys window | grep DisplayWidth except Exception, e: print "Failed to get device display width and height: [%s]" % str( e) # to 480*800 display # Notification (y: 0-37 / x: 8-471 ) self.notification_height = 37 self.abs_action_bar_bottom = None
class SoloInterface: """ Solo Interface for Automated Testing """ Android_Class_Name_Dict = { "Button": "android.widget.Button", "CheckBox": "android.widget.CheckBox", "EditText": "android.widget.EditText", "ImageButton": "android.widget.ImageButton", "ImageVIew": "android.widget.ImageView", "RadioButton": "android.widget.RadioButton", "TextView": "android.widget.TextView", "View": "android.view.View", "ProgressBar": "android.widget.ProgressBar", "ScrollView": "android.widget.ScrollView", } def __init__( self, device_name="emulator-5554", device_port=5554, device_address="127.0.0.1", view_server_port=4939, monkey_server_port=12345, ): """ Constructor """ self.class_name = "SoloInterface" self.m_logger = Logger.InitLog("solo-interface.log", logging.getLogger("solo-interface.thread")) self.device_name = device_name self.device_port = device_port self.device_address = device_address self.view_server_port = view_server_port self.monkey_server_port = monkey_server_port # object of Device self.device = Device( self.m_logger, self.device_name, self.device_port, self.device_address, self.view_server_port, self.monkey_server_port, ) # init device self.device.open() # build View Tree self.vt = ViewTree(self.m_logger) self.tree_nodes_list = None # object of View Controller self.event_controller = EventController( self.m_logger, self.device_name, self.device_port, self.device_address, self.monkey_server_port ) # init event controller self.event_controller.open() try: self.device_display_width = int(self.event_controller.getDisplayWidth()) self.device_display_height = int(self.event_controller.getDisplayHeight()) # LCD density is in the build.prop: # adb shell getprop ro.sf.lcd_density # And the resolution is availble in the dumpsys of the input activity: # # windows # adb shell dumpsys window | find "DisplayWidth" # # linux # adb shell dumpsys window | grep DisplayWidth except Exception, e: print "Failed to get device display width and height: [%s]" % str(e) # to 480*800 display # Notification (y: 0-37 / x: 8-471 ) self.notification_height = 37 self.abs_action_bar_bottom = None