How to use clickMouseButtonLeft method in pyatom

Best Python code snippet using pyatom_python

AutoOrder.py

Source:AutoOrder.py Github

copy

Full Screen

...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()...

Full Screen

Full Screen

automateMac.py

Source:automateMac.py Github

copy

Full Screen

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

Full Screen

Full Screen

base_element.py

Source:base_element.py Github

copy

Full Screen

...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))...

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