How to use builtin_adb_path method in Airtest

Best Python code snippet using Airtest

test_adb.py

Source:test_adb.py Github

copy

Full Screen

...10 @classmethod11 def setUpClass(cls):12 cls.adb = ADB()13 def test_adb_path(self):14 self.assertTrue(os.path.exists(self.adb.builtin_adb_path()))15 def test_start_server(self):16 self.adb.start_server()17 def test_version(self):18 self.assertIn("1.0.39", self.adb.version())19 def test_other_adb_server(self):20 adb = ADB(server_addr=("localhost", 5037))21 self.assertIn("1.0.39", adb.version())22 def test_start_cmd(self):23 proc = self.adb.start_cmd("devices", device=False)24 self.assertIsInstance(proc, subprocess.Popen)25 self.assertIsNotNone(proc.stdin)26 self.assertIsNotNone(proc.stdout)27 self.assertIsNotNone(proc.stderr)28 out, err = proc.communicate()...

Full Screen

Full Screen

helper.py

Source:helper.py Github

copy

Full Screen

...77 # 获取当前操作系统的平台名称78 system = platform.system()79 logger.info(f'当前操作系统: {system}')80 # 通过AirTest的ADB静态方法获取ADB路径81 adb_path = ADB.builtin_adb_path()82 logger.debug(f'AirTest ADB路径: {adb_path}')83 if system == 'Darwin' or system == 'Linux':84 # if current OS is macOS, Linux or Linux Arm, grant the permission to AirTest ADB...

Full Screen

Full Screen

adb.py

Source:adb.py Github

copy

Full Screen

...29 if not executable:30 os.chmod(file_path, mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)31 return True32 return False33def builtin_adb_path():34 """35 Return built-in adb executable path36 Returns:37 adb executable path38 """39 system = platform.system()40 machine = platform.machine()41 adb_path = DEFAULT_ADB_PATH.get('{}-{}'.format(system, machine))42 if not adb_path:43 adb_path = DEFAULT_ADB_PATH.get(system)44 if not adb_path:45 raise RuntimeError("No adb executable supports this platform({}-{}).".format(system, machine))46 # overwrite uiautomator adb47 if "ANDROID_HOME" in os.environ:48 del os.environ["ANDROID_HOME"]49 if system != "Windows":50 # chmod +x adb51 make_file_executable(adb_path)52 return adb_path53class ADB(object):54 def __init__(self):55 self.adb_path = builtin_adb_path()56 def shell(self, cmd, deviceId):57 run_cmd = f'{self.adb_path} -s {deviceId} shell {cmd}'58 result = subprocess.Popen(run_cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[59 0].decode("utf-8").strip()60 return result...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Airtest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful