Best Python code snippet using Airtest
savedProject.py
Source: savedProject.py
1screenSize = (1920, 1080)2allCommandsSave = [[['comment', '%46 Zoom'],3 ['launch', '.\\words.pptx'],4 ['wait', 2.0],5 ['maximize_window'],6 ['wait', 2.0],7 ['comment', 'Setup'],8 ['double_click', [971, 285], (139, 207, 243)],9 ['left_click', [441, 124], (243, 242, 241)],10 ['left_click', [443, 159], (243, 242, 241)],11 ['wait', 1.0],12 ['maximize_window'],13 ['left_click', [835, 61], (255, 255, 255)],14 ['write_variable', 'v1'],15 ['press_key', 'enter'],16 ['double_click', [294, 219], (134, 75, 80)],17 ['repeat_commands_for_wildcards'],18 ['comment', 'First Row'],19 ['comment', 'First Card'],20 ['double_click', [977, 289], (184, 63, 31)],21 ['left_click', [458, 134], (243, 242, 241)],22 ['left_click', [455, 159], (225, 223, 221)],23 ['wildcard'],24 ['press_key', 'enter'],25 ['double_click', [989, 362], (255, 223, 223)],26 ['hotkey', 'ctrl a'],27 ['wildcard'],28 ['press_key', 'enter'],29 ['hotkey', 'ctrl k'],30 ['wildcard'],31 ['comment', 'Second Card'],32 ['double_click', [1100, 288], (138, 211, 249)],33 ['left_click', [473, 128], (130, 128, 126)],34 ['left_click', [464, 170], (243, 242, 241)],35 ['wildcard'],36 ['press_key', 'enter'],37 ['double_click', [1114, 360], (255, 255, 255)],38 ['hotkey', 'ctrl a'],39 ['wildcard'],40 ['press_key', 'enter'],41 ['hotkey', 'ctrl k'],42 ['wildcard'],43 ['comment', 'Third Card'],44 ['double_click', [1225, 294], (140, 207, 242)],45 ['left_click', [423, 132], (243, 242, 241)],46 ['left_click', [440, 159], (243, 242, 241)],47 ['wildcard'],48 ['press_key', 'enter'],49 ['double_click', [1218, 359], (221, 221, 221)],50 ['hotkey', 'ctrl a'],51 ['wildcard'],52 ['press_key', 'enter'],53 ['hotkey', 'ctrl k'],54 ['wildcard'],55 ['comment', 'Second Row'],56 ['comment', 'Forth Card'],57 ['double_click', [969, 435], (139, 207, 243)],58 ['left_click', [468, 129], (186, 184, 184)],59 ['left_click', [469, 162], (243, 242, 241)],60 ['wildcard'],61 ['press_key', 'enter'],62 ['double_click', [973, 497], (255, 255, 255)],63 ['hotkey', 'ctrl a'],64 ['wildcard'],65 ['press_key', 'enter'],66 ['hotkey', 'ctrl k'],67 ['wildcard'],68 ['comment', 'Fifth Card'],69 ['double_click', [1097, 418], (179, 151, 108)],70 ['left_click', [471, 128], (243, 242, 241)],71 ['left_click', [457, 157], (186, 184, 184)],72 ['wildcard'],73 ['press_key', 'enter'],74 ['double_click', [1093, 497], (255, 255, 255)],75 ['hotkey', 'ctrl a'],76 ['wildcard'],77 ['press_key', 'enter'],78 ['hotkey', 'ctrl k'],79 ['wildcard'],80 ['comment', 'Sixth Card'],81 ['double_click', [1222, 428], (139, 207, 243)],82 ['left_click', [440, 132], (243, 242, 241)],83 ['left_click', [451, 169], (243, 242, 241)],84 ['wildcard'],85 ['press_key', 'enter'],86 ['double_click', [1206, 498], (255, 80, 80)],87 ['hotkey', 'ctrl a'],88 ['wildcard'],89 ['press_key', 'enter'],90 ['hotkey', 'ctrl k'],91 ['wildcard'],92 ['comment', 'Third Row'],93 ['comment', 'Seventh Card'],94 ['double_click', [972, 558], (136, 199, 230)],95 ['left_click', [450, 132], (243, 242, 241)],96 ['left_click', [450, 149], (243, 242, 241)],97 ['wildcard'],98 ['press_key', 'enter'],99 ['double_click', [980, 633], (255, 64, 64)],100 ['hotkey', 'ctrl a'],101 ['wildcard'],102 ['press_key', 'enter'],103 ['hotkey', 'ctrl k'],104 ['wildcard'],105 ['comment', 'Eighth Card'],106 ['double_click', [1110, 568], (201, 103, 0)],107 ['left_click', [470, 129], (111, 109, 108)],108 ['left_click', [449, 158], (243, 242, 241)],109 ['wildcard'],110 ['press_key', 'enter'],111 ['double_click', [1106, 630], (71, 71, 71)],112 ['hotkey', 'ctrl a'],113 ['wildcard'],114 ['press_key', 'enter'],115 ['hotkey', 'ctrl k'],116 ['wildcard'],117 ['comment', 'Ninth Card'],118 ['double_click', [1212, 570], (139, 207, 243)],119 ['left_click', [458, 124], (243, 242, 241)],120 ['left_click', [461, 165], (243, 242, 241)],121 ['wildcard'],122 ['press_key', 'enter'],123 ['double_click', [1214, 635], (255, 255, 255)],124 ['hotkey', 'ctrl a'],125 ['wildcard'],126 ['press_key', 'enter'],127 ['hotkey', 'ctrl k'],128 ['wildcard'],129 ['comment', 'Fourth Row'],130 ['comment', 'Tenth Card'],131 ['double_click', [974, 701], (139, 208, 244)],132 ['left_click', [465, 126], (243, 242, 241)],133 ['left_click', [434, 155], (243, 242, 241)],134 ['wildcard'],135 ['press_key', 'enter'],136 ['double_click', [1003, 766], (255, 255, 255)],137 ['hotkey', 'ctrl a'],138 ['wildcard'],139 ['press_key', 'enter'],140 ['wildcard'],141 ['comment', 'Eleventh Card'],142 ['double_click', [1111, 712], (138, 66, 117)],143 ['left_click', [477, 130], (72, 70, 68)],144 ['left_click', [464, 160], (243, 242, 241)],145 ['wildcard'],146 ['press_key', 'enter'],147 ['double_click', [1113, 767], (255, 255, 255)],148 ['hotkey', 'ctrl a'],149 ['wildcard'],150 ['press_key', 'enter'],151 ['hotkey', 'ctrl k'],152 ['wildcard'],153 ['comment', 'Twelfth Card'],154 ['double_click', [1220, 698], (139, 207, 243)],155 ['left_click', [413, 124], (243, 242, 241)],156 ['left_click', [433, 167], (243, 242, 241)],157 ['wildcard'],158 ['press_key', 'enter'],159 ['double_click', [1219, 773], (255, 255, 255)],160 ['hotkey', 'ctrl a'],161 ['wildcard'],162 ['press_key', 'enter'],163 ['hotkey', 'ctrl k'],164 ['wildcard'],165 ['comment', 'Fifth Row'],166 ['comment', '13th Card'],167 ['double_click', [980, 840], (139, 140, 122)],168 ['left_click', [432, 133], (243, 242, 241)],169 ['left_click', [428, 165], (243, 242, 241)],170 ['wildcard'],171 ['press_key', 'enter'],172 ['double_click', [970, 906], (255, 255, 255)],173 ['hotkey', 'ctrl a'],174 ['wildcard'],175 ['press_key', 'enter'],176 ['hotkey', 'ctrl k'],177 ['wildcard'],178 ['comment', '14th Card'],179 ['double_click', [1100, 833], (141, 210, 249)],180 ['left_click', [452, 122], (243, 242, 241)],181 ['left_click', [462, 160], (130, 128, 126)],182 ['wildcard'],183 ['press_key', 'enter'],184 ['double_click', [1105, 908], (255, 255, 255)],185 ['hotkey', 'ctrl a'],186 ['wildcard'],187 ['press_key', 'enter'],188 ['hotkey', 'ctrl k'],189 ['wildcard'],190 ['comment', '15th Card'],191 ['double_click', [1216, 835], (139, 207, 243)],192 ['left_click', [492, 131], (91, 89, 87)],193 ['left_click', [471, 164], (130, 128, 126)],194 ['wildcard'],195 ['press_key', 'enter'],196 ['double_click', [1246, 904], (255, 96, 96)],197 ['hotkey', 'ctrl a'],198 ['wildcard'],199 ['press_key', 'enter'],200 ['hotkey', 'ctrl k'],201 ['wildcard'],202 ['comment', 'Add a new page'],203 ['left_click', [114, 443], (210, 216, 83)],204 ['press_key', 'home'],205 ['hotkey', 'ctrl c'],206 ['press_key', 'end'],207 ['hotkey', 'ctrl v'],208 ['end_repeat_commands_for_wildcards'],209 ['press_key', 'esc'],210 ['left_click', [144, 700], (255, 255, 255)],211 ['press_key', 'home'],212 ['left_click', [144, 340], (199, 179, 137)]],213 [['double_click', [976, 291], (165, 170, 121)],214 ['left_click', [1868, 193], (243, 242, 241)],215 ['left_click', [1614, 278], (210, 71, 38)],216 ['left_click', [1510, 755], (255, 255, 255)],217 ['comment', 'Start sizing'],218 ['repeat_commands_for_wildcards'],219 ['comment', 'Picture 1'],220 ['double_click', [725, 293], (116, 166, 188)],221 ['left_click', [1616, 271], (210, 71, 38)],222 ['double_click', [1804, 355], (255, 255, 255)],223 ['hotkey', 'ctrl a'],224 ['write_text', '5,07'],225 ['press_key', 'tab'],226 ['write_text', '5,73'],227 ['press_key', 'tab'],228 ['repeat_previous', 8, 0.0],229 ['write_text', '0,88'],230 ['press_key', 'tab'],231 ['repeat_previous', 1, 0.0],232 ['write_text', '0,97'],233 ['comment', 'Picture 2'],234 ['double_click', [845, 296], (139, 207, 243)],235 ['left_click', [1805, 359], (226, 168, 103)],236 ['hotkey', 'ctrl a'],237 ['write_text', '5,07'],238 ['press_key', 'tab'],239 ['write_text', '5,73'],240 ['press_key', 'tab'],241 ['repeat_previous', 8, 0.0],242 ['write_text', '6,6'],243 ['press_key', 'tab'],244 ['repeat_previous', 1, 0.0],245 ['write_text', '1'],246 ['comment', 'Picture 3'],247 ['double_click', [967, 271], (119, 155, 173)],248 ['left_click', [1807, 359], (255, 255, 255)],249 ['hotkey', 'ctrl a'],250 ['write_text', '5,06'],251 ['press_key', 'tab'],252 ['write_text', '5,78'],253 ['press_key', 'tab'],254 ['repeat_previous', 8, 0.0],255 ['write_text', '12,39'],256 ['press_key', 'tab'],257 ['repeat_previous', 1, 0.0],258 ['write_text', '1,02'],259 ['comment', 'Picture 4'],260 ['double_click', [718, 433], (139, 207, 243)],261 ['left_click', [1809, 358], (255, 255, 255)],262 ['hotkey', 'ctrl a'],263 ['write_text', '5,06'],264 ['press_key', 'tab'],265 ['write_text', '5,73'],266 ['press_key', 'tab'],267 ['repeat_previous', 8, 0.0],268 ['write_text', '0,88'],269 ['press_key', 'tab'],270 ['repeat_previous', 1, 0.0],271 ['write_text', '7,6'],272 ['comment', 'Picture 5'],273 ['double_click', [844, 427], (139, 208, 244)],274 ['left_click', [1806, 363], (255, 226, 168)],275 ['hotkey', 'ctrl a'],276 ['write_text', '4,92'],277 ['press_key', 'tab'],278 ['write_text', '5,73'],279 ['press_key', 'tab'],280 ['repeat_previous', 8, 0.0],281 ['write_text', '6,6'],282 ['press_key', 'tab'],283 ['repeat_previous', 1, 0.0],284 ['write_text', '7,6'],285 ['comment', 'Picture 6'],286 ['double_click', [973, 436], (139, 207, 243)],287 ['left_click', [1803, 354], (255, 255, 255)],288 ['hotkey', 'ctrl a'],289 ['write_text', '4,95'],290 ['press_key', 'tab'],291 ['write_text', '5,84'],292 ['press_key', 'tab'],293 ['repeat_previous', 8, 0.0],294 ['write_text', '12,33'],295 ['press_key', 'tab'],296 ['repeat_previous', 1, 0.0],297 ['write_text', '7,6'],298 ['comment', 'Picture 7'],299 ['double_click', [730, 561], (185, 111, 43)],300 ['left_click', [1813, 359], (197, 136, 68)],301 ['hotkey', 'ctrl a'],302 ['write_text', '5,14'],303 ['press_key', 'tab'],304 ['write_text', '5,73'],305 ['press_key', 'tab'],306 ['repeat_previous', 8, 0.0],307 ['write_text', '0,88'],308 ['press_key', 'tab'],309 ['repeat_previous', 1, 0.0],310 ['write_text', '14,03'],311 ['comment', 'Picture 8'],312 ['double_click', [846, 577], (139, 207, 243)],313 ['left_click', [1803, 358], (255, 255, 255)],314 ['hotkey', 'ctrl a'],315 ['write_text', '4,68'],316 ['press_key', 'tab'],317 ['write_text', '5,78'],318 ['press_key', 'tab'],319 ['repeat_previous', 8, 0.0],320 ['write_text', '6,6'],321 ['press_key', 'tab'],322 ['repeat_previous', 1, 0.0],323 ['write_text', '14,06'],324 ['comment', 'Picture 9'],325 ['double_click', [980, 572], (249, 97, 164)],326 ['left_click', [1808, 361], (255, 255, 255)],327 ['hotkey', 'ctrl a'],328 ['write_text', '4,68'],329 ['press_key', 'tab'],330 ['write_text', '5,79'],331 ['press_key', 'tab'],332 ['repeat_previous', 8, 0.0],333 ['write_text', '12,33'],334 ['press_key', 'tab'],335 ['repeat_previous', 1, 0.0],336 ['write_text', '14,06'],337 ['comment', 'Picture 10'],338 ['double_click', [730, 700], (210, 102, 3)],339 ['left_click', [1809, 359], (103, 168, 226)],340 ['hotkey', 'ctrl a'],341 ['write_text', '4,72'],342 ['press_key', 'tab'],343 ['write_text', '5,78'],344 ['press_key', 'tab'],345 ['repeat_previous', 8, 0.0],346 ['write_text', '0,82'],347 ['press_key', 'tab'],348 ['repeat_previous', 1, 0.0],349 ['write_text', '20,36'],350 ['comment', 'Picture 11'],351 ['double_click', [846, 698], (0, 0, 0)],352 ['left_click', [1805, 357], (255, 255, 255)],353 ['hotkey', 'ctrl a'],354 ['write_text', '4,74'],355 ['press_key', 'tab'],356 ['write_text', '5,84'],357 ['press_key', 'tab'],358 ['repeat_previous', 8, 0.0],359 ['write_text', '6,49'],360 ['press_key', 'tab'],361 ['repeat_previous', 1, 0.0],362 ['write_text', '20,3'],363 ['comment', 'Picture 12'],364 ['double_click', [968, 703], (0, 0, 0)],365 ['left_click', [1804, 359], (255, 255, 255)],366 ['hotkey', 'ctrl a'],367 ['write_text', '4,74'],368 ['press_key', 'tab'],369 ['write_text', '5,9'],370 ['press_key', 'tab'],371 ['repeat_previous', 8, 0.0],372 ['write_text', '12,27'],373 ['press_key', 'tab'],374 ['repeat_previous', 1, 0.0],375 ['write_text', '20,36'],376 ['comment', 'Picture 13'],377 ['double_click', [729, 838], (255, 208, 159)],378 ['left_click', [1805, 358], (255, 255, 226)],379 ['hotkey', 'ctrl a'],380 ['write_text', '4,5'],381 ['press_key', 'tab'],382 ['write_text', '5,67'],383 ['press_key', 'tab'],384 ['repeat_previous', 8, 0.0],385 ['write_text', '0,91'],386 ['press_key', 'tab'],387 ['repeat_previous', 1, 0.0],388 ['write_text', '26,69'],389 ['comment', 'Picture 14'],390 ['double_click', [858, 831], (255, 203, 154)],391 ['left_click', [1805, 360], (255, 226, 168)],392 ['hotkey', 'ctrl a'],393 ['write_text', '4,65'],394 ['press_key', 'tab'],395 ['write_text', '5,62'],396 ['press_key', 'tab'],397 ['repeat_previous', 8, 0.0],398 ['write_text', '6,67'],399 ['press_key', 'tab'],400 ['repeat_previous', 1, 0.0],401 ['write_text', '26,55'],402 ['comment', 'Picture 15'],403 ['double_click', [977, 832], (211, 173, 119)],404 ['left_click', [1814, 359], (68, 68, 68)],405 ['hotkey', 'ctrl a'],406 ['write_text', '4,58'],407 ['press_key', 'tab'],408 ['write_text', '5,9'],409 ['press_key', 'tab'],410 ['repeat_previous', 8, 0.0],411 ['write_text', '12,27'],412 ['press_key', 'tab'],413 ['repeat_previous', 1, 0.0],414 ['write_text', '26,65'],415 ['left_click', [221, 211], (117, 119, 120)],416 ['press_key', 'down'],417 ['end_repeat_commands_for_wildcards'],418 ['press_key', 'esc'],419 ['left_click', [1888, 224], (119, 119, 119)]]]...
SitBidPlay.py
Source: SitBidPlay.py
...44 selW.click("id=bid_pass")45# self.failIf(sel.is_visible("id=bidbox"))46# self.failUnless(sel.is_visible("id=lead_area"))47 time.sleep(2)48 selE.double_click('id=card_14')49 time.sleep(2)50 selN.double_click('id=card_13')51 time.sleep(2)52 selW.double_click('id=card_20')53 time.sleep(2)54 selN.double_click('id=card_21')55# wait till sel.get_text('id=NS_tricks') == '1'56 time.sleep(1)57 selN.double_click('id=card_15')58 time.sleep(1)59 selE.double_click('id=card_25')60 time.sleep(1)61 selN.double_click('id=card_18')62 time.sleep(1)63 selW.double_click('id=card_17')64 time.sleep(1)65 selE.double_click('id=card_16')66 time.sleep(1)67 selN.double_click('id=card_23')68 time.sleep(1)69 selW.double_click('id=card_42')70 time.sleep(1)71 selN.double_click('id=card_19')72 time.sleep(1)73 selN.double_click('id=card_3')74 time.sleep(1)75 selW.double_click('id=card_0')76 time.sleep(1)77 selN.double_click('id=card_7')78 time.sleep(1)79 selE.double_click('id=card_11')80 time.sleep(1)81 selE.double_click('id=card_41')82 time.sleep(1)83 selN.double_click('id=card_39')84 time.sleep(1)85 selW.double_click('id=card_48')86 time.sleep(1)87 selN.double_click('id=card_51')88 time.sleep(1)89 selN.double_click('id=card_26')90 time.sleep(1)91 selE.double_click('id=card_27')92 time.sleep(1)93 selN.double_click('id=card_38')94 time.sleep(1)95 selW.double_click('id=card_31')96 time.sleep(1)97 selN.double_click('id=card_33')98 time.sleep(1)99 selW.double_click('id=card_36')100 time.sleep(1)101 selN.double_click('id=card_37')102 time.sleep(1)103 selE.double_click('id=card_28')104 time.sleep(1)105 selN.double_click('id=card_35')106 time.sleep(1)107 selE.double_click('id=card_29')108 time.sleep(1)109 selN.double_click('id=card_40')110 time.sleep(1)111 selW.double_click('id=card_5')112 time.sleep(1)113 selN.double_click('id=card_12')114 time.sleep(1)115 selE.double_click('id=card_1')116 time.sleep(1)117 selN.double_click('id=card_8')118 time.sleep(1)119 selW.double_click('id=card_6')120 time.sleep(1)121 selN.double_click('id=card_4')122 time.sleep(1)123 selE.double_click('id=card_2')124 time.sleep(1)125 selN.double_click('id=card_10')126 time.sleep(1)127 selW.double_click('id=card_9')128 time.sleep(1)129 selN.double_click('id=card_45')130 time.sleep(1)131 selW.double_click('id=card_49')132 time.sleep(1)133 selN.double_click('id=card_44')134 time.sleep(1)135 selE.double_click('id=card_30')136 time.sleep(1)137 selW.double_click('id=card_50')138 time.sleep(1)139 selN.double_click('id=card_22')140 time.sleep(1)141 selE.double_click('id=card_32')142 time.sleep(1)143 selN.double_click('id=card_46')144 time.sleep(1)145 selN.double_click('id=card_24')146 time.sleep(1)147 selE.double_click('id=card_34')148 time.sleep(1)149 selN.double_click('id=card_47')150 time.sleep(1)151 selW.double_click('id=card_43')152 153 def tearDown(self):154 self.seleniumN.click('xpath=//span[@id=\'user_header\']/a[2]')155 self.seleniumE.click('xpath=//span[@id=\'user_header\']/a[2]')156 self.seleniumS.click('xpath=//span[@id=\'user_header\']/a[2]')157 self.seleniumW.click('xpath=//span[@id=\'user_header\']/a[2]')158 self.seleniumN.stop()159 self.seleniumE.stop()160 self.seleniumS.stop()161 self.seleniumW.stop()162 self.assertEqual([], self.verificationErrors)163if __name__ == "__main__":...
demo01多态性.py
Source: demo01多态性.py
...4# MP4è§é¢ --åå» ææ¾è§é¢5from abc import abstractmethod,ABCMeta6class Double_File(metaclass=ABCMeta): #æ½è±¡ç¶ç±»7 @abstractmethod8 def double_click(self):9 pass10#å®ç°å¤æ11class Double_Txt(Double_File):12 def double_click(self):13 print('åå»txtæ件,æå¼txtæ件')14class Double_exe(Double_File):15 def double_click(self):16 print('åå»exeæ件,å®è£
æ件')17class Double_Mp4(Double_File):18 def double_click(self):19 print('åå»mp4æ件,è§é¢ææ¾')20#ä¼ å
¥ä¸åçæ件类åï¼å®ç°å¤ææ§21def double_click(file_obj):22 file_obj.double_click()23#è°ç¨å®ç°å¤ææ§24txt = Double_Txt()25double_click(txt)26exe = Double_exe()27double_click(exe)28mp4 = Double_Mp4()...
Check out the latest blogs from LambdaTest on this topic:
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.
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.
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.
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.
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.
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!!