How to use _main_activity_from_apk method in robotframework-androidlibrary

Best Python code snippet using robotframework-androidlibrary_python

__init__.py

Source:__init__.py Github

copy

Full Screen

...249 "forward",250 "tcp:%d" % self._port,251 "tcp:7102"252 ])253 package_name, main_activity = self._main_activity_from_apk(apk)254 if '.' not in main_activity or main_activity[0] == '.':255 main_activity = "%s.%s" % (package_name, main_activity.lstrip('.'))256 args = [257 self._adb,258 "shell",259 "am",260 "instrument",261 "-w",262 "-e",263 "target_package",264 package_name,265 "-e",266 "main_activity",267 main_activity,268 "-e",269 "test_server_port",270 str(7102),271 "-e",272 "class",273 "sh.calaba.instrumentationbackend.InstrumentationBackend",274 "%s.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner" % package_name,275 ]276 self._testserver_proc = subprocess.Popen(args)277 def _main_activity_from_apk(self, apk):278 '''279 Returns the package_name and the Main-Action280 from a given apk281 '''282 rc, output, errput = self._execute_with_timeout([self._calabash_bin_path, "extract-manifest", apk])283 xmldoc = minidom.parseString(output)284 manifest = xmldoc.getElementsByTagName("manifest")285 assert len(manifest) > 0, "No <manifest> tag found in manifest file"286 manifest = manifest[0]287 package = manifest.getAttribute("package")288 assert package is not None, "Could not find package name in apk: %s manifest: %s" % (apk, output)289 for node in xmldoc.getElementsByTagName("action"):290 if node.getAttribute("android:name") == "android.intent.action.MAIN":291 return package, node.parentNode.parentNode.getAttribute("android:name")...

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 robotframework-androidlibrary 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