Best Python code snippet using pyatom_python
AutoOrder.py
Source: AutoOrder.py
...24 def clickComboBox(ComboBox, itemIndex=0):25 CodeButton = ComboBox.AXChildren[0]26 CodeButton.Press()27 CodeText = ComboBox.AXChildren[1].AXChildren[0].AXChildren[itemIndex]28 CodeText.clickMouseButtonLeft(CodeText.AXPosition)29 def setMarketCode(self, allComboBox, marketCode='SZ'):30 marketCodeComboBox = allComboBox[0]31 if marketCode in self.config['marketCode']:32 marketCoedIndex = int(self.config['marketCode'][marketCode])33 AutoOrder.clickComboBox(marketCodeComboBox, marketCoedIndex)34 else:35 logging.error("Market Code is invalid: " + marketCode)36 raise ValueError37 @staticmethod38 def checkSocketCodeValid(socketCode):39 if re.match('[0-9]+$', socketCode) is None:40 logging.error('SocketCode can contain number only: ', socketCode)41 raise ValueError42 elif len(socketCode) != 6:43 logging.error('SocketCode should be length of 6: ', socketCode)44 raise ValueError45 return True46 @staticmethod47 def setStockCode(allTextField, socketCode=""):48 AutoOrder.checkSocketCodeValid(socketCode)49 socketCodeText = allTextField[0]50 socketCodeText.AXSelectedText = socketCode51 socketCodeText.Confirm()52 @staticmethod53 def checkPriceWayValid(priceWay):54 if priceWay not in (1, 2, 3, 4, 5):55 logging.error('Price Way should be 1 to 5: ', str(priceWay))56 raise ValueError57 else:58 return True59 @staticmethod60 def setPriceWay(allComboBox, priceWay):61 AutoOrder.checkPriceWayValid(priceWay)62 AutoOrder.clickComboBox(allComboBox[1], priceWay - 1)63 @staticmethod64 def setPrice(allTextField, price):65 if price <= 0:66 print('@ Trading on original market price')67 else:68 allTextField[2].AXValue = str(price)69 @staticmethod70 def setQuantity(allTextField, allQuantityButton, quantity):71 if quantity <= 0:72 allQuantityButton.clickMouseButtonLeft(allQuantityButton.AXPosition)73 else:74 allTextField[1].AXValue = str(quantity)75 def confirm(self, app, mainWindow, directionTab, isAction):76 try:77 actionButton = mainWindow.findFirst(AXRole='AXButton', AXTitle=directionTab + self.config['actionText'])78 actionButton.clickMouseButtonLeft(actionButton.AXPosition)79 except atomacos.errors.AXErrorCannotComplete:80 logging.info('Action not complete error, cannot find a way to handle this fail')81 dialog = app.windows()[0]82 confirmInfo = dialog.staticTexts()[1]83 logging.info('@' + '|'.join(confirmInfo.AXValue.split('\r')[2:7]))84 actionConfirmName = self.config['confirmAction'][isAction]85 ActionConfirmButton = dialog.buttons(actionConfirmName)[0]86 ActionConfirmButton.Press()87 def order(self, directionTab, marketCode, socketCode, priceWay=1, price=-1, quantity=-1, isAction=False):88 app = self.activate()89 mainWindow = app.windows()[0]90 self.clickCheckBox(mainWindow, directionTab)91 allComboBox = mainWindow.findAll(AXRole='AXComboBox')92 allTextField = mainWindow.textFields()...
automateMac.py
Source: automateMac.py
...56 def jump_page(instrument, index):57 page_group = instrument.windows()[0].group()[0].splitgroup()[0]58 page_obj = page_group.group()[0].outline()[0].row()[index].table()[0].row()[1]59 # 第ä¸æ¬¡ç¹å»åªå°appçªå£ï¼ç¬¬äºæ¬¡ç¹å»æå°æ§ä»¶å页60 page_obj.clickMouseButtonLeft(page_obj.AXPosition)61 time.sleep(0.1)62 page_obj.clickMouseButtonLeft(page_obj.AXPosition)63 64 def get_systeminfo(instrument, appname):65 systeminfo = []66 s_splitgroup = instrument.windows()[0].group()[0].splitgroup()[0]67 68 datalist = s_splitgroup.splitgroup()[0].scollarea()[0].table()[0].row()69 for i in datalist:70 data = i.text()71 if data[1].AXValue == appname:72 for j in data:73 systeminfo.append(j.AXValue)74 return systeminfo75 76 ...
base_element.py
Source: base_element.py
...65 def left_click(self):66 position = self.element.AXPosition67 size = self.element.AXSize68 click_position = ((position[0] + size[0]/2), (position[1] + size[1]/2))69 self.element.clickMouseButtonLeft(click_position)70 def enter_username(self, username):71 self.element.sendKey(atomac.AXKeyCodeConstants.TAB)72 self.element.sendKey(atomac.AXKeyCodeConstants.TAB)73 self.send_keys(username)74 def enter_password(self, password):75 self.element.sendKey(atomac.AXKeyCodeConstants.TAB)76 self.send_keys(password)77 def enter_personal_key(self, password):78 self.element.sendKey(atomac.AXKeyCodeConstants.TAB)79 self.send_keys(password)80 def is_visible(self):81 if self.element != None:82 return True83 return False84 def get_text(self):85 return str(self.element._getAttribute('AXValue'))86 def mouse_click(self, kwargs):87 self.element = self.element.findFirstR(**kwargs)88 position = self.element.AXPosition89 size = self.element.AXSize90 click_position = ((position[0] + size[0] / 2), (position[1] + size[1] / 2))...
Check out the latest blogs from LambdaTest on this topic:
Pair testing can help you complete your testing tasks faster and with higher quality. But who can do pair testing, and when should it be done? And what form of pair testing is best for your circumstance? Check out this blog for more information on how to conduct pair testing to optimize its benefits.
We launched LT Browser in 2020, and we were overwhelmed by the response as it was awarded as the #5 product of the day on the ProductHunt platform. Today, after 74,585 downloads and 7,000 total test runs with an average of 100 test runs each day, the LT Browser has continued to help developers build responsive web designs in a jiffy.
To understand the agile testing mindset, we first need to determine what makes a team “agile.” To me, an agile team continually focuses on becoming self-organized and cross-functional to be able to complete any challenge they may face during a project.
The QA testing career includes following an often long, winding road filled with fun, chaos, challenges, and complexity. Financially, the spectrum is broad and influenced by location, company type, company size, and the QA tester’s experience level. QA testing is a profitable, enjoyable, and thriving career choice.
Dries Buytaert, a graduate student at the University of Antwerp, came up with the idea of developing something similar to a chat room. Moreover, he modified the conventional chat rooms into a website where his friends could post their queries and reply through comments. However, for this project, he thought of creating a temporary archive of posts.
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!!