How to use test_custom_cap_method method in Airtest

Best Python code snippet using Airtest

test_screen_proxy.py

Source:test_screen_proxy.py Github

copy

Full Screen

...58 scale_factor = min(default_height, height) / height59 projection = (scale_factor * width, scale_factor * height)60 screen = string_2_img(self.dev.screen_proxy.get_frame(projection=projection))61 self.assertEqual(screen.shape[0], default_height)62 def test_custom_cap_method(self):63 """64 Test adding a custom screenshot method65 测试添加一个自定义的截图方法66 Returns:67 """68 from airtest.core.android.cap_methods.base_cap import BaseCap69 class TestCap(BaseCap):70 def get_frame_from_stream(self):71 return b"frame"72 ScreenProxy.register_method("TESTCAP", TestCap)73 # 默认优先初始化为自定义的TestCap74 cap = ScreenProxy.auto_setup(self.dev.adb)75 self.assertIsInstance(cap.screen_method, TestCap)76 ScreenProxy.SCREEN_METHODS.pop("TESTCAP")...

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