How to use get_blank_screen method in Airtest

Best Python code snippet using Airtest

mjpeg_cap.py

Source: mjpeg_cap.py Github

copy

Full Screen

...84 # 等待下一次需要获取屏幕时,再进行重连85 LOGGING.debug("mjpegsock is closed")86 self._is_running = False87 self.buf.close()88 return self.get_blank_screen()89 def get_frame(self):90 # 获得单张屏幕截图91 return self.get_frame_from_stream()92 def snapshot(self, ensure_orientation=True, *args, **kwargs):93 """94 Take a screenshot and convert it into a cv2 image object95 获取一张屏幕截图,并转化成cv2的图像对象96 !!! 注意,该方法拿到的截图可能不是队列中最新的,除非一直在消费队列中的图像,否则可能会是过往图像内容,请谨慎使用97 Args:98 ensure_orientation: True or False whether to keep the orientation same as display99 Returns: numpy.ndarray100 """101 screen = self.get_frame_from_stream()102 try:103 screen = aircv.utils.string_2_img(screen)104 except Exception:105 # may be black/​locked screen or other reason, print exc for debugging106 traceback.print_exc()107 return None108 if ensure_orientation:109 if self.ori_function:110 display_info = self.ori_function()111 orientation = next(key for key, value in ROTATION_MODE.items() if value == display_info["orientation"])112 screen = aircv.rotate(screen, -orientation, clockwise=False)113 return screen114 def get_blank_screen(self):115 """116 生成一个黑屏图像,在连接失效时代替屏幕画面返回117 Returns:118 """119 if self.ori_function:120 display_info = self.ori_function()121 width, height = display_info['width'], display_info['height']122 if display_info["orientation"] in [90, 270]:123 width, height = height, width124 else:125 width, height = 1080, 1920126 img = numpy.zeros((width, height, 3)).astype('uint8')127 img_string = aircv.utils.img_2_string(img)128 return img_string...

Full Screen

Full Screen

test_ios_mjpeg.py

Source: test_ios_mjpeg.py Github

copy

Full Screen

...52 cv2.imshow("test", img)53 c = cv2.waitKey(10)54 time.sleep(0.05)55 cv2.destroyAllWindows()56 def test_get_blank_screen(self):57 img_string = self.mjpeg_server.get_blank_screen()58 img = aircv.utils.string_2_img(img_string)59 aircv.show(img)60 def test_teardown_stream(self):61 self.mjpeg_server.get_frame()62 if self.mjpeg_server.port_forwarding is True:63 self.assertTrue(is_port_open(self.mjpeg_server.ip, self.mjpeg_server.port))64 self.mjpeg_server.teardown_stream()...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

QA’s and Unit Testing – Can QA Create Effective Unit Tests

Unit testing is typically software testing within the developer domain. As the QA role expands in DevOps, QAOps, DesignOps, or within an Agile team, QA testers often find themselves creating unit tests. QA testers may create unit tests within the code using a specified unit testing tool, or independently using a variety of methods.

LIVE With Automation Testing For OTT Streaming Devices ????

People love to watch, read and interact with quality content — especially video content. Whether it is sports, news, TV shows, or videos captured on smartphones, people crave digital content. The emergence of OTT platforms has already shaped the way people consume content. Viewers can now enjoy their favorite shows whenever they want rather than at pre-set times. Thus, the OTT platform’s concept of viewing anything, anytime, anywhere has hit the right chord.

Why Agile Is Great for Your Business

Agile project management is a great alternative to traditional methods, to address the customer’s needs and the delivery of business value from the beginning of the project. This blog describes the main benefits of Agile for both the customer and the business.

Options for Manual Test Case Development & Management

The purpose of developing test cases is to ensure the application functions as expected for the customer. Test cases provide basic application documentation for every function, feature, and integrated connection. Test case development often detects defects in the design or missing requirements early in the development process. Additionally, well-written test cases provide internal documentation for all application processing. Test case development is an important part of determining software quality and keeping defects away from customers.

Test strategy and how to communicate it

I routinely come across test strategy documents when working with customers. They are lengthy—100 pages or more—and packed with monotonous text that is routinely reused from one project to another. Yawn once more— the test halt and resume circumstances, the defect management procedure, entrance and exit criteria, unnecessary generic risks, and in fact, one often-used model replicates the requirements of textbook testing, from stress to systems integration.

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