How to use guiexist method in pyatom

Best Python code snippet using pyatom_python

1.3.2.2-VideoScan.py

Source:1.3.2.2-VideoScan.py Github

copy

Full Screen

...84 wide = onexrandr[0]85 high = onexrandr[1]86 g_ldtpObj.setResolution(g_osName, wide, high)87 time.sleep(4)88 if guiexist(u'dlg\u9519\u8bef') == 1:89 return 90 g_sst.scrprint('1.3.2.2-VideoScan',wide+'x'+high,g_currentPath)91 92 g_ldtpObj.setResolution(g_osName, pixelList[0], pixelList[1])93 time.sleep(4)94 g_sst.scrprint('1.3.2.2-VideoScan','best pixel',g_currentPath)95 return96def openVideo_kylin(tran_dir):97 g_log.ilog(g_tag,'opening')98 print "open video..."99 print tran_dir100 os.system('smplayer '+tran_dir+' &')101 time.sleep(3) 102 print "open video finish..."103 return104def scanVideo_kylin():105 g_log.ilog(g_tag,'Is editing video')106 print ('Is scaning video')107 time.sleep(3)108 #Voice109 print ('up voice start')110 for a in range(0,5):111 up = chr(48)112 keypress('<'+up+'>')113 keyrelease('<'+up+'>')114 time.sleep(1)115 print ('up voice end')116 117 os.system('killall firefox')118 119 g_sst.scrprint('1.3.2.2-VideoScan','voice up',g_currentPath)120 print ('down voice start')121 for a in range(0,1):122 down = chr(57)123 keypress('<'+down+'>')124 keyrelease('<'+down+'>')125 time.sleep(1)126 print ('down voice end')127 g_sst.scrprint('1.3.2.2-VideoScan','voice down',g_currentPath)128 #Progress 129 print ('Progress increase')130 for a in range(0,2):131 keypress('<up>')132 keyrelease('<up>')133 time.sleep(2)134 g_sst.scrprint('1.3.2.2-VideoScan','progress increase',g_currentPath)135 print ('Progress decrease')136 #for a in range(0,2):137 # keypress('<down>')138 # keyrelease('<dowm>')139 # time.sleep(2)140 if g_s3 == 1:141 os.system('echo '+password+' | sudo -S rtcwake -m mem -s 120')142 time.sleep(10)143 g_sst.scrprint('1.3.2.2-VideoScan','S3',g_currentPath)144 else:145 g_log.wlog(g_tag,'os not S3')146 if g_s4 == 1:147 os.system('echo '+password+' | sudo -S rtcwake -m disk -s 120')148 g_sst.scrprint('1.3.2.2-VideoScan','S4',g_currentPath)149 else:150 g_log.wlog(g_tag,'os not S4') 151 return152def maxWindow_kylin():153 print ('maxwindow')154 maxwindow = chr(102)155 keypress('<'+maxwindow+'>')156 keyrelease('<'+maxwindow+'>')157 time.sleep(3)158 g_sst.scrprint('1.3.2.2-VideoScan','maxwindow',g_currentPath)159 return160def closeWindow_kylin():161 print ('close window .....')162 os.system('killall smplayer') 163 return164 165def openVideo_cos(tran_dir):166 g_log.ilog(g_tag,'opening')167 print "open video..."168 print tran_dir169 os.system('totem '+tran_dir+' &')170 time.sleep(3) 171 if guiexist(u'dlg\u9519\u8bef') == 1:172 173 return 174 175 print "open video finish..."176 return177def scanVideo_cos():178 g_log.ilog(g_tag,'Is editing video')179 print ('Is scaning video')180 time.sleep(3)181 if guiexist(u'dlg\u9519\u8bef') == 1:182 return183 for a in range(0,5):184 keypress('<down>')185 keyrelease('<down>')186 time.sleep(1)187 if guiexist(u'dlg\u9519\u8bef') == 1:188 189 return190 print ('down voice end')191 g_sst.scrprint('1.3.2.2-VideoScan','voice down',g_currentPath)192 for a in range(0,4):193 keypress('<up>')194 keyrelease('<up>')195 time.sleep(1)196 if guiexist(u'dlg\u9519\u8bef') == 1:197 198 return199 print ('up voice end')200 g_sst.scrprint('1.3.2.2-VideoScan','voice up',g_currentPath)201 #Progress 202 print ('Progress increase')203 for a in range(0,2):204 keypress('<right>')205 keyrelease('<right>')206 time.sleep(2)207 if guiexist(u'dlg\u9519\u8bef') == 1:208 return209 g_sst.scrprint('1.3.2.2-VideoScan','progress increase',g_currentPath)210 print ('Progress decrease')211 for a in range(0,2):212 keypress('<left>')213 keyrelease('<left>')214 time.sleep(2)215 if guiexist(u'dlg\u9519\u8bef') == 1:216 return217 g_sst.scrprint('1.3.2.2-VideoScan','progress decrease',g_currentPath)218 if g_s3 == 1:219 os.system('echo '+password+' | sudo -S rtcwake -m mem -s 120')220 time.sleep(10)221 g_sst.scrprint('1.3.2.2-VideoScan','S3',g_currentPath)222 else:223 g_log.wlog(g_tag,'os not S3')224 if guiexist(u'dlg\u9519\u8bef') == 1:225 return226 if g_s4 == 1:227 os.system('echo '+password+' | sudo -S rtcwake -m disk -s 120')228 g_sst.scrprint('1.3.2.2-VideoScan','S4',g_currentPath)229 else:230 g_log.wlog(g_tag,'os not S4')231 print ('edit end ...')232 return233def maxWindow_cos(name):234 print ('maxwindow')235 if guiexist(u'dlg\u9519\u8bef') != 1:236 print name237 maximizewindow(name)238 g_sst.scrprint('1.3.2.2-VideoScan','maxwindow',g_currentPath)239 else: 240 return241 242 time.sleep(3)243 return244def closeWindow_cos():245 print ('close window .....') 246 os.system('killall totem') 247 return248def getCmdResult(cmd):249 process = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)250 (o, e) = process.communicate()251 return o.strip()252 253def main():254 if platform.architecture()[0] == "64bit":255 name = ""256 videospacename =''257 for i in range(0, 5):258 if i == 0:259 tran_dir = os.path.expanduser(video_source_name)260 print tran_dir261 print '0*******'262 name = os.path.basename(tran_dir)263 print name264 if not os.path.exists(tran_dir):265 g_log.ilog(g_tag,'video resource not exist')266 print ('not exist video source')267 continue 268 elif i == 1:269 tran_dir = os.path.expanduser(video_source_name1)270 print tran_dir271 print '1*******'272 name = os.path.basename(tran_dir)273 print name274 if not os.path.exists(tran_dir):275 g_log.ilog(g_tag,'video resource not exist')276 print ('not exist video source')277 continue278 elif i == 2:279 tran_dir = os.path.expanduser(video_source_name2)280 print tran_dir281 print '2*******'282 name = os.path.basename(tran_dir)283 print name284 if not os.path.exists(tran_dir):285 g_log.ilog(g_tag,'video resource not exist')286 print ('not exist video source')287 continue 288 elif i == 3:289 tran_dir = os.path.expanduser(video_source_name3)290 print tran_dir291 print '3*******'292 name = os.path.basename(tran_dir)293 print name294 if not os.path.exists(tran_dir):295 g_log.ilog(g_tag,'video resource not exist')296 print ('not exist video source')297 continue298 elif i == 4:299 tran_dir = os.path.expanduser(video_source_name4)300 print tran_dir301 print '4*******'302 name = os.path.basename(tran_dir)303 print name304 if not os.path.exists(tran_dir):305 g_log.ilog(g_tag,'video resource not exist')306 print ('not exist video source')307 continue308 if len(name.split(' ')) > 1:309 for videoname in name.split(' '):310 videospacename += videoname + '\\' + ' '311 name = videospacename[:-2]312 print name313 os.path.dirname(tran_dir)314 tran_dir = os.path.dirname(tran_dir) +'/'+ name315 print tran_dir316 videospacename = ''317 else:318 pass319 print name320 321 openVideo_kylin(tran_dir)322 #picobj.enableMouseKeyboard(False)323 scanVideo_kylin()324 maxWindow_kylin()325 time.sleep(2)326 #picobj.enableMouseKeyboard(True)327 change_pixel()328 if i == 0:329 #change_pixel()330 os.system(g_currentPath+videodir+'resolution_rotate.sh')331 pass332 print ('conti.....')333 #picobj.enableMouseKeyboard(False)334 closeWindow_kylin()335 time.sleep(5)336 #picobj.enableMouseKeyboard(True)337 return338 if platform.architecture()[0] == "32bit":339 cmd = 'dpkg -l | grep gstreamer1.0-plugins-ugly | awk \'{print $1}\''340 if g_osName == 'cos' and getCmdResult(cmd) != 'ii':341 print "is installing codec-debs"342 os.chdir(g_install+'/tools/build116a-codec-debs')343 os.system('echo '+password+' | sudo -S ./install.sh')344 os.chdir(g_currentPath)345 print "install finish"346 347 name = ""348 videospacename =''349 for i in range(0, 5):350 if i == 0:351 tran_dir = os.path.expanduser(video_source_name)352 print tran_dir353 print '0*******'354 name = os.path.basename(tran_dir)355 print name356 if not os.path.exists(tran_dir):357 g_log.ilog(g_tag,'video resource not exist')358 print ('not exist video source')359 continue 360 elif i == 1:361 tran_dir = os.path.expanduser(video_source_name1)362 print tran_dir363 print '1*******'364 name = os.path.basename(tran_dir)365 print name366 if not os.path.exists(tran_dir):367 g_log.ilog(g_tag,'video resource not exist')368 print ('not exist video source')369 continue370 elif i == 2:371 tran_dir = os.path.expanduser(video_source_name2)372 print tran_dir373 print '2*******'374 name = os.path.basename(tran_dir)375 print name376 if not os.path.exists(tran_dir):377 g_log.ilog(g_tag,'video resource not exist')378 print ('not exist video source')379 continue 380 elif i == 3:381 tran_dir = os.path.expanduser(video_source_name3)382 print tran_dir383 print '3*******'384 name = os.path.basename(tran_dir)385 print name386 if not os.path.exists(tran_dir):387 g_log.ilog(g_tag,'video resource not exist')388 print ('not exist video source')389 continue390 elif i == 4:391 tran_dir = os.path.expanduser(video_source_name4)392 print tran_dir393 print '4*******'394 name = os.path.basename(tran_dir)395 print name396 if not os.path.exists(tran_dir):397 g_log.ilog(g_tag,'video resource not exist')398 print ('not exist video source')399 continue400 if len(name.split(' ')) > 1:401 for videoname in name.split(' '):402 videospacename += videoname + '\\' + ' '403 name = videospacename[:-2]404 print name405 os.path.dirname(tran_dir)406 tran_dir = os.path.dirname(tran_dir) +'/'+ name407 print tran_dir408 videospacename = ''409 else:410 pass411 print name412 openVideo_cos(tran_dir)413 if guiexist(u'dlg\u9519\u8bef') == 1:414 g_sst.scrprint('1.3.2.2-VideoScan','Conventional flow error',g_currentPath)415 os.system('killall totem')416 continue417 time.sleep(3)418 scanVideo_cos()419 if guiexist(u'dlg\u9519\u8bef') == 1:420 g_sst.scrprint('1.3.2.2-VideoScan','Conventional flow error',g_currentPath)421 os.system('killall totem')422 continue423 maxWindow_cos(name)424 if guiexist(u'dlg\u9519\u8bef') == 1:425 g_sst.scrprint('1.3.2.2-VideoScan','Conventional flow error',g_currentPath)426 os.system('killall totem')427 continue428 if g_osName == 'cos':429 g_log.ilog(g_tag,'not setResolution ')430 if g_osName == 'isoft':431 change_pixel()432 if guiexist(u'dlg\u9519\u8bef') == 1:433 g_sst.scrprint('1.3.2.2-VideoScan','Conventional flow error',g_currentPath)434 os.system('killall totem')435 continue436 if i == 0:437 print ("start run resolution_rotate.sh")438 #change_pixel()439 os.system(g_currentPath+videodir+'resolution_rotate.sh')440 441 time.sleep(5)442 if guiexist(u'dlg\u9519\u8bef') == 1:443 g_sst.scrprint('1.3.2.2-VideoScan','Conventional flow error',g_currentPath)444 os.system('killall totem')445 continue446 closeWindow_cos()447 time.sleep(3)448 print ('conti.....')449 return450 451if __main__=="__main__":...

Full Screen

Full Screen

test.py

Source:test.py Github

copy

Full Screen

...38# test.wait(3)39# size=test.getobjectsize("Jay")40# test.generatemouseevent(size[0] + 100, size[1] + 5, "b3c")41# test.generatemouseevent(size[0]-100, size[1], "b1d")42# print test.guiexist("gedit")43# print test.guiexist("gedit", "txt0")44# print test.guiexist("Open")45# print test.guiexist("Open", "btnCancel")46# print test.guiexist("Open", "C0ncel")47# print "waittillguiexist"48# print test.waittillguiexist("Open")49# print test.waittillguiexist("Open", "btnCancel")50# print test.waittillguiexist("Open", "C0ncel", 10)51# print "waittillguinotexist"52# print test.waittillguinotexist("Open", guiTimeOut=5)53# print test.waittillguinotexist("Open", "btnCancel", 5)54# print test.waittillguinotexist("Open", "C0ncel")55# print windows56# objList = test.getobjectlist("frmTryitEditorv1.5")57# for obj in objList:58# if re.search("^tbl\d", obj):59# print obj, test.getrowcount("frmTryitEditorv1.5", obj)60# print test.selectrow("Accounts", "tbl0", "VMware")61# print test.selectrowpartialmatch("Accounts", "tbl0", "Zim")62# print test.selectrowindex("Accounts", "tbl0", 0)63# print test.selectlastrow("Accounts", "tbl0")64# print test.getcellvalue("Accounts", "tbl0", 1)...

Full Screen

Full Screen

t_pm_helpabout.py

Source:t_pm_helpabout.py Github

copy

Full Screen

...49 def tearDown(self):50 pkg5unittest.SingleDepotTestCase.tearDown(self)51 def testPmHelp(self):52 ldtp.launchapp(self.pm_str,["-R", self.get_img_path()])53 ldtp.waittillguiexist('Package Manager', state = ldtp.state.ENABLED)54 ldtp.selectmenuitem('Package Manager', 'mnuHelp;mnuContents')55 # Verify result56 ldtp.waittillguiexist('*Online Help')57 self.assertEqual(ldtp.guiexist('*Online Help'), 1)58 ldtp.selectmenuitem('*Online Help', 'mnuCloseWindow')59 ldtp.selectmenuitem('Package Manager', 'mnuHelp;mnuAbout')60 # Verify result61 self.assertEqual(ldtp.guiexist('About Package Manager'), 1)62 ldtp.waittillguiexist('dlgAboutPackageManager')63 ldtp.click('dlgAboutPackageManager', 'btnClose')64 # Quit Package Manager65 ldtp.selectmenuitem('Package Manager', 'mnuFile;mnuQuit')66if __name__ == "__main__":...

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 pyatom 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