Best Python code snippet using pyatom_python
CASXF-194.py
Source:CASXF-194.py
1import uiautomation as automation2import time3from pynput.mouse import Button,Controller4def sugicalseg(i,x,y):5 AutomationId = "sugicalseg"+str(i)6 sugicalseg = automation.RadioButtonControl(AutomationId=AutomationId)7 sugicalseg.Click()8 automation.Win32API.MouseRightClick(x,y,0.1)9 automation.Win32API.MouseRightClick(x,y)10cas = automation.WindowControl(AutomationId="myMainWindow", Name="PatientManager", ClassName="Window", searchDepth=1)11cas.SetActive()12for loop in range(100):13 surgical_renalArtery_Scratch = cas.ButtonControl(AutomationId="surgical_renalArtery_Scratch")14 surgical_renalArtery_Scratch.Click()15 # æ§è¡æ示æ¡16 barwindow = automation.WindowControl(AutomationId="myMainWindow", Name="MetroProBarWindow", searchDepth=1)17 while not automation.WaitForDisappear(barwindow, 3):18 time.sleep(3)19 sugicalseg(1,858,451)20 sugicalseg(2,753,452)21 sugicalseg(3,979,487)22 sugicalseg(4,988,531)23 sugicalseg(5,991,594)24 sugicalseg(6,989,634)25 sugicalseg(7,743,552)26 sugicalseg(8,758,559)27 sugicalseg(9,741,619)28 sugicalseg(10,734,641)29 sugicalseg(11,764,647)30 surgical_show_Scratch =cas.ButtonControl(AutomationId="surgical_show_Scratch")31 surgical_show_Scratch.Click()32 # æ§è¡æ示æ¡33 barwindow = automation.WindowControl(AutomationId="myMainWindow", Name="MetroProBarWindow", searchDepth=1)34 while not automation.WaitForDisappear(barwindow, 3):35 time.sleep(3)36 cas.CaptureToImage("å段æ¾ç¤ºç»æ%d"%loop)37 surgeryLiverSavecom = cas.ComboBoxControl(AutomationId="surgeryLiverSavecom",foundIndex=1)38 surgeryLiverSavecom.Select(u"æ¯æ°ç®¡-æ¹æ¡1")39 SurgerySimulationASave =cas.ButtonControl(AutomationId="SurgerySimulationASave")40 SurgerySimulationASave.Click()41 time.sleep(5)42 surgeryLiverShowcom= cas.ComboBoxControl(AutomationId="surgeryLiverShowcom")43 surgeryLiverShowcom.Select(u"æ¯æ°ç®¡-æ¹æ¡1")44 SurgerySimulationAShow =cas.ButtonControl(AutomationId="SurgerySimulationAShow")45 SurgerySimulationAShow.Click()46 time.sleep(5)47 automation.Win32API.MouseMoveTo(754,665)48 automation.Win32API.MouseMiddleClick(754,665,0.1)49 automation.Win32API.MouseMiddleClick(754,665)50 51 time.sleep(3)52 cas.CaptureToImage("å段ä¸é´åå»%d"%loop)...
seyin.py
Source:seyin.py
1import sys2import time3from Quartz.CoreGraphics import *4# æµè¯å®æåå¯æ¹æ100æå
¶å®æ¬¡æ°5N = 16def mouseEvent(type, posx, posy):7 theEvent = CGEventCreateMouseEvent(8 None, type, (posx, posy), kCGMouseButtonLeft)9 CGEventPost(kCGHIDEventTap, theEvent)10def mousemove(posx, posy):11 mouseEvent(kCGEventMouseMoved, posx, posy)12def mouseClick(posx, posy):13 mouseEvent(kCGEventLeftMouseDown, posx, posy)14 mouseEvent(kCGEventLeftMouseUp, posx, posy)15def mouseRightClick(posx, posy):16 mouseEvent(kCGEventRightMouseDown, posx, posy)17 mouseEvent(kCGEventRightMouseUp, posx, posy)18def clickLeftButton():19 # Move to the confirm button20 mousemove(104, 900 - 336)21 # 1 second delay22 time.sleep(0.5)23 # Click the confirm button24 mouseClick(104, 900 - 336)25 # 1 second delay26 time.sleep(0.5)27def clickMenu():28 # Click the menu29 mousemove(98, 900 - 619)30 time.sleep(0.5)31 mouseClick(98, 900 - 619)32 # 1 second delay33 time.sleep(0.5)34ourEvent = CGEventCreate(None)35# Save current mouse position36currentpos = CGEventGetLocation(ourEvent)37for _ in range(1, N):38 # Click the NPC39 mousemove(685, 448)40 time.sleep(1)41 mouseRightClick(685, 448)42 time.sleep(1)43 clickMenu()44 clickLeftButton()45 clickLeftButton()46# Restore mouse position...
start.py
Source:start.py
1from main import *2from header import *3def setup():4 size(game.startX + game.boardWidth * game.tileSize, game.startY + game.boardHeight * game.tileSize)5 stroke(0)6 background(0, 0, 0)7 initBoard()8 restart()9 noLoop()10 #print(board)11 12def draw():13 drawBoard()14 15def mouseClicked():16 tileX = ((mouseX - game.startX) ) / game.tileSize17 tileY = ((mouseY - game.startY) ) / game.tileSize18 if mouseButton == LEFT:19 mouseLeftClick(tileX, tileY)20 #print("------ Your pressed board[" + str(tileX) + "][" + str(tileY) + "] with a type of " + str(game.board[tileX][tileY].type) + " and revealed: " + str(game.board[tileX][tileY].revealed))21 elif mouseButton == RIGHT:22 mouseRightClick(tileX, tileY)23 redraw()24 25def keyTyped():26 tileX = ((mouseX - game.startX) ) / game.tileSize27 tileY = ((mouseY - game.startY) ) / game.tileSize28 if key == 'R' or key == 'r': 29 restart()30 elif key == ' ':31 #print("------ Your pressed board[" + str(tileX) + "][" + str(tileY) + "] is flagged: " + str(game.board[tileX][tileY].flagged) + " and revealed: " + str(game.board[tileX][tileY].revealed))32 mouseRightClick(tileX, tileY)33 elif key == 'o' or key == 'O':34 mouseLeftClick(tileX, tileY)...
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!!