How to use count_record_pos method in Airtest

Best Python code snippet using Airtest

cv.py

Source:cv.py Github

copy

Full Screen

...207 this class predicts the press_point and the area to search im_search.208 """209 DEVIATION = 100210 @staticmethod211 def count_record_pos(pos, resolution):212 """计算坐标对应的中点偏移值相对于分辨率的百分比."""213 _w, _h = resolution214 # 都按宽度缩放,针对G18的实验结论215 delta_x = (pos[0] - _w * 0.5) / _w216 delta_y = (pos[1] - _h * 0.5) / _w217 delta_x = round(delta_x, 3)218 delta_y = round(delta_y, 3)219 return delta_x, delta_y220 @classmethod221 def get_predict_point(cls, record_pos, screen_resolution):222 """预测缩放后的点击位置点."""223 delta_x, delta_y = record_pos224 _w, _h = screen_resolution225 target_x = delta_x * _w + _w * 0.5...

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