class QueryOrder(): ''' classdocs ''' def __init__(self): ''' Constructor ''' self.commonActions = CommonActions() self.getinfo = ModifyInfoElements() def accessQueryOrder(self, driver): self.commonActions.readPublishINfo(driver) queryOrderXpath = '//*[@class="menu_list clearfix"]/li[4]/a/span[2]' self.commonActions.click(driver, queryOrderXpath) iframe = 'contentIframeTwo' driver.switch_to_frame(iframe) #时间选择 bgnTimeXpath = '//*[@id="myCommissonStart"]' self.commonActions.click(driver, bgnTimeXpath) time.sleep(2) driver.switch_to_default_content() iframeXpath = '//*[@src="about:blank"]' iframe1 = driver.find_element_by_xpath(iframeXpath) print "123" driver.switch_to_frame(iframe1) yesterdayXpath = '//*[@class="WdayTable"]/tbody/tr[7]/td[2]' self.commonActions.click(driver, yesterdayXpath) time.sleep(6) driver.switch_to_default_content() driver.switch_to_frame(iframe) queryOrderBtnXpath = '//*[@id="reSearch"]' self.commonActions.click(driver, queryOrderBtnXpath)
class AcountCenterActions(): ''' classdocs ''' def __init__(self): self.commonActions = CommonActions() self.getinfo = SetParameters() def accessAc(self, driver): self.commonActions.readPublishINfo(driver) myAccountXpath = self.getinfo.setMyAccountXpath() accountCenterXpath = self.getinfo.setAccountCenterXpath() self.commonActions.moveToElement(driver, accountCenterXpath) self.commonActions.click(driver, myAccountXpath) self.commonActions.switchToIframe(driver) def checkUserInfo(self, driver): self.accessAc(driver) sql = 'select balance,credit_amount,frozen_amount from account_fund where account_id=' + "'" + '5279' + "'" data = self.commonActions.conn(sql) return data def verifyUserInfo(self, driver, data): totalBalanceXpath = self.getinfo.setTotalBalanceXpath() balanceXpath = self.getinfo.setBalanceXpath() frozenXpath = self.getinfo.setFrozenXpath() totalBalance = self.commonActions.getElementText( driver, totalBalanceXpath) balance = self.commonActions.getElementText(driver, balanceXpath) frozen = self.commonActions.getElementText(driver, frozenXpath) flag = False if data[0] == int(float(totalBalance) * 100): if data[1] == int(float(balance) * 100): if data[2] == int(float(frozen) * 100): flag = True return flag else: print "冻结余额不正确!" return flag else: print "可用余额不正确!" return flag else: print "总金额不正确!" return flag def cardAdd(self, driver, card_row, card_col, num_row, num_col): self.accessAc(driver) #点击添加银行卡 cardAddXpath = self.getinfo.setCardAddXpath() self.commonActions.click(driver, cardAddXpath) #点击选择其他银行 choseOtherBankXpath = self.getinfo.setChoseOtherCardXpath() self.commonActions.click(driver, choseOtherBankXpath) #选择银行卡 BankXpath = self.getinfo.setAcConfig(card_row, card_col) self.commonActions.click(driver, BankXpath) bankNum = self.getinfo.setAcConfig(num_row, num_col) bankNumXpath = self.getinfo.setBankNumXpath() self.commonActions.sendContent(driver, bankNumXpath, bankNum) phoneXpath = self.getinfo.setPhoneNumXpath() phoneNum = self.commonActions.userName self.commonActions.sendContent(driver, phoneXpath, phoneNum) sendVercodeXpath = self.getinfo.setSendVerCodeXpath() self.commonActions.click(driver, sendVercodeXpath) time.sleep(2) #获取验证码 sql = 'select version from account_fund where account_id=' + "'" + '5279' + "'" time.sleep(1) data = self.commonActions.conn(sql) vercodeXpath = self.getinfo.setVerCodeXpath() self.commonActions.sendContent(driver, vercodeXpath, data[0]) dredgeQuickPayXpath = self.getinfo.setDredgeQuickPay() self.commonActions.click(driver, dredgeQuickPayXpath) return data
class ModifyInfo(): ''' classdocs ''' def __init__(self): ''' Constructor ''' self.commonActions=CommonActions() self.getinfo=ModifyInfoElements() def accessModifyInfo(self,driver): self.commonActions.readPublishINfo(driver) safeCenterXpath=self.getinfo.getSafeCenterXpath() modifyInfoXpath=self.getinfo.getModifyInfoXpath() modifyNowXpath=self.getinfo.getModifyBtnXpath() self.commonActions.moveToElement(driver, safeCenterXpath) #self.commonActions.switchToIframe(driver) self.commonActions.click(driver, modifyInfoXpath) self.commonActions.switchToIframe(driver) self.commonActions.click(driver, modifyNowXpath) def modifyInfo(self,driver,sn_row,sn_col,st_row,st_col,p_row,p_col,c_row,c_col,a_row,a_col,ad_row,ad_col,qq_row,qq_col): self.accessModifyInfo(driver) #填写店铺名称 shopNameXpath=self.getinfo.getShopNameXpath() shopName=self.getinfo.getModifyInfo(sn_row,sn_col) self.commonActions.sendContent(driver, shopNameXpath, shopName) #填写店铺类型 shopTypeXpath=self.getinfo.getShopTypeXpath() shopType=self.getinfo.getModifyInfo(st_row,st_col) self.commonActions.click(driver, shopTypeXpath) self.commonActions.click(driver, shopType) #选择省份 provinceXpath=self.getinfo.getProvinceXpath() self.commonActions.click(driver, provinceXpath) province=self.getinfo.getModifyInfo(p_row,p_col) self.commonActions.click(driver, province) #选择城市 cityXpath=self.getinfo.getCityXpath() self.commonActions.click(driver, cityXpath) city=self.getinfo.getModifyInfo(c_row,c_col) self.commonActions.click(driver, city) #选择地区 areaXpath=self.getinfo.getAreaXpath() self.commonActions.click(driver, areaXpath) area=self.getinfo.getModifyInfo(a_row,a_col) self.commonActions.click(driver, area) #填写地址 addressXpath=self.getinfo.getAddressXpath() address=self.getinfo.getModifyInfo(ad_row,ad_col) self.commonActions.sendContent(driver, addressXpath, address) qqNumXpath=self.getinfo.getQQNumXpath() qqNum=self.getinfo.getModifyInfo(qq_row,qq_col) self.commonActions.sendContent(driver, qqNumXpath, qqNum) #点击确定 confirmXpath=self.getinfo.getConfirmBtnXpath() self.commonActions.click(driver, confirmXpath) def verifyModifyInfo(self,driver): standard=self.getinfo.getModifyInfo(17, 0) resultXpath=self.getinfo.getSuccessInfoXpath() result=self.commonActions.getElementText(driver, resultXpath) flag=False print standard,result if standard==result: flag=True return flag return flag