Best Python code snippet using lisa_python
runner.py
Source:runner.py
...69 def start_runner(self, data):70 options = data.get('options', {})71 port = options.get('port')72 profile = Profile(profile=options.get('profile'))73 self.runner.device.setup_port_forwarding(local_port=port, remote_port=port)74 self.runner.profile = profile75 self.runner.start()76 if not self.runner.device.wait_for_port(port):77 raise Exception("Wait for port timed out")78 def stop_runner(self, data):79 self.runner.stop()80class DeviceHandler(MozrunnerHandler):81 def __init__(self, *args, **kwargs):82 serial = kwargs.pop('serial', None)83 MozrunnerHandler.__init__(self, *args, **kwargs)84 self.runner = B2GDeviceRunner(serial=serial, **self.common_runner_args)85 self.runner.device.connect()86 def start_runner(self, data):87 options = data.get('options', {})88 port = options.get('port')89 profile = Profile(profile=options.get('profile'))90 self.runner.device.setup_port_forwarding(local_port=port, remote_port=port)91 self.runner.profile = profile92 self.runner.start()93 self.runner.device.setup_port_forwarding(local_port=port, remote_port=port)94 if not self.runner.device.wait_for_port(port):95 raise Exception("Wait for port timed out")96 def stop_runner(self, data):...
base_test.py
Source:base_test.py
...20 cls.desired_caps = {}21 cls.driver = webdriver.Remote('http://localhost:4723/wd/hub', cls.desired_caps)22 print("Appium driver started")23 time.sleep(10)24 cls.setup_port_forwarding()25 cls.altdriver = AltUnityDriver()26 @classmethod27 def setup_port_forwarding(cls):28 try:29 AltUnityAndroidPortForwarding().remove_forward_port_device()30 except:31 print("No adb forward was present")32 try:33 AltUnityiOSPortForwarding.kill_all_iproxy_process()34 except:35 print("No iproxy forward was present")36 if cls.platform == 'android':37 AltUnityAndroidPortForwarding().forward_port_device()38 print("Port forwarded (Android).")39 else:40 AltUnityiOSPortForwarding().forward_port_device()41 print("Port forwarded (iOS).")...
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!