def do_email(self, action, variables): d.screen.on() d.press.home() Adb.start("com.google.android.gm/com.google.android.gm.ComposeActivityGmail") d(resourceId="com.google.android.gm:id/to").click() Adb.write(action['value']) d.press.enter() d(resourceId="com.google.android.gm:id/subject").click() Adb.write(self.get_var("$titulo", variables)) d(resourceId="com.google.android.gm:id/body").click() Adb.write(self.get_var("$mensagem", variables)) d(resourceId="com.google.android.gm:id/send").click()
def do_email(self, action, variables): d.screen.on() d.press.home() Adb.start( "com.google.android.gm/com.google.android.gm.ComposeActivityGmail") d(resourceId="com.google.android.gm:id/to").click() Adb.write(action['value']) d.press.enter() d(resourceId="com.google.android.gm:id/subject").click() Adb.write(self.get_var("$titulo", variables)) d(resourceId="com.google.android.gm:id/body").click() Adb.write(self.get_var("$mensagem", variables)) d(resourceId="com.google.android.gm:id/send").click()
def generate(self): result = Adb.shell("dumpsys", "location").replace("\n", "").replace("\r", "") m = re.match(".*Last Known Locations:.*gps: Location\[gps (.*?) acc=(.*?) et.*Last Known.*", result) coordinates = None accuracy = 0 try: coordinates_tuple_str = tuple(StrUtils.split(m.group(1), ",", 2)) print(coordinates_tuple_str) coordinates = tuple(map(lambda x: float(x.replace(",", ".")), coordinates_tuple_str)) accuracy = 1 - (int(m.group(2)) / self.acceptable_distance) except AttributeError: traceback.print_exc() # m can be None return {"value": coordinates, "accuracy": accuracy}
def do_facebook(self, action, variables): contact = action["value"] d.screen.on() d.press.home() Adb.start("com.facebook.orca/.auth.StartScreenActivity") d(resourceId="com.facebook.orca:id/action_search").click() Adb.write(contact) d(className="android.widget.ListView").child(index=1).click() d(resourceId="com.facebook.orca:id/edit_text").click() Adb.write(self.get_var("$mensagem", variables)) d(description="Enviar").click()
def generate(self): result = Adb.shell("dumpsys", "location").replace("\n", "").replace("\r", "") m = re.match( ".*Last Known Locations:.*gps: Location\[gps (.*?) acc=(.*?) et.*Last Known.*", result) coordinates = None accuracy = 0 try: coordinates_tuple_str = tuple(StrUtils.split(m.group(1), ",", 2)) print(coordinates_tuple_str) coordinates = tuple( map(lambda x: float(x.replace(",", ".")), coordinates_tuple_str)) accuracy = 1 - (int(m.group(2)) / self.acceptable_distance) except AttributeError: traceback.print_exc() # m can be None return {"value": coordinates, "accuracy": accuracy}