def confirmGoods(self, frame): ahkpython.sendAlipayPassword(self.alipayPassword) frame = frame.childFrames()[0] confirmButton = frame.findFirstElement('div.submit-line input.btn') # Below maybe the right way to confirm a js popup window. # 1. Start the confirm operation thread first, then press the confirm button to trigger the js popup. class PreJsConfirm(threading.Thread): def run(self): time.sleep(4) ahkpython.confirmJavaScript() self.asynClickOn(2, confirmButton) pjc = PreJsConfirm() pjc.setDaemon(True) pjc.start()
def refund(self, frame): self.clickOn(frame.findFirstElement('input#good-unreceived')) self.selectDropdownList(frame.findFirstElement('select#J_RefundReason2'), 1) self.setValueOn(frame.findFirstElement('textarea#J_RefundInfo'), u'卖家没货') ahkpython.sendAlipayPassword(self.alipayPassword) frame = frame.childFrames()[0] confirmButton = frame.findFirstElement('div.submit-line input') class PreJsConfirm(threading.Thread): def run(self): time.sleep(4) ahkpython.confirmJavaScript() self.asynClickOn(2, confirmButton) pjc = PreJsConfirm() pjc.setDaemon(True) pjc.start()
def alipay(self, frame, userInfo): # Set status to confirmed buy. # jiawzhang XXX: The string to be saved to sqlite must be unicode first, otherwise, error happens. AutoAction.userInfoManager.setUserInfoStatus(userInfo, UserInfo.Status_Confirmed_Buy) confirmButton = frame.findFirstElement('input.J_ForAliControl') if not confirmButton.isNull(): ahkpython.sendAlipayPassword(self.alipayPassword) # jiawzhang XXX: Should Have a Async Click On Confirm Button for Security ActiveX Inputbox # Other wise, you will always get button clicked first, then fill the password into the Security ActiveX Inputbox, which lead to issues. self.asynClickOn(2, confirmButton) else: # Set status to fail to buy if there is no comfirmed button for alipay page. AutoAction.userInfoManager.setUserInfoStatus(userInfo, UserInfo.Status_Failed_Buy) QMessageBox.information(None, u'支付失败', u'您的支付宝余额可能不足,即将停止拍货,请充值后重新拍货。', QMessageBox.Ok) self.emit(SIGNAL('terminateAll'))