def get_transactions(self, pending=False): if pending: self.t.find_button('Pending Charges').click() else: self.t.find_button('Posted Transactions').click() dates = [ parser.parse(' '.join([x.text for x in xs])).isoformat() for xs in zip( self.t.browser.driver.find_elements_by_xpath( '//*[contains(@class, "estmt-date")]'), self.t.browser.driver.find_elements_by_xpath( '//*[contains(@class, "estmt-month")]'), self.t.browser.driver.find_elements_by_xpath( '//*[contains(@class, "estmt-year")]')) ] descs = [ x.text for x in self.t.browser.driver.find_elements_by_xpath( '//*[contains(@class, "desc-trans")]') ] amounts = [ utils.parse_dols(x.text) for x in self.t.browser.driver.find_elements_by_xpath( '//*[contains(@class, "colAmount")]') ] return [ Transaction(dt, desc, '', amt, not pending) for dt, desc, amt in zip(dates, descs, amounts) if amt > 0 ]
def get_transactions(self, pending=False): if pending: self.t.find_button('Pending Charges').click() else: self.t.find_button('Posted Transactions').click() dates = [parser.parse(' '.join([x.text for x in xs])).isoformat() for xs in zip( self.t.browser.driver.find_elements_by_xpath('//*[contains(@class, "estmt-date")]'), self.t.browser.driver.find_elements_by_xpath('//*[contains(@class, "estmt-month")]'), self.t.browser.driver.find_elements_by_xpath('//*[contains(@class, "estmt-year")]') )] descs = [x.text for x in self.t.browser.driver.find_elements_by_xpath('//*[contains(@class, "desc-trans")]') ] amounts = [utils.parse_dols(x.text) for x in self.t.browser.driver.find_elements_by_xpath('//*[contains(@class, "colAmount")]') ] return [ Transaction(dt, desc, '', amt, not pending) for dt, desc, amt in zip(dates, descs, amounts) if amt > 0 ]
def get_transactions(self, pending=False): f = self.t.browser.driver.find_elements_by_xpath if pending: el = self.t.find_el_xp('//span[contains(text(), "Pending Transactions")]') if el.text == 'View Pending Transactions': el.click() dates_xp = '//*[@id="pendingTransactionTable"]//div[contains(@class, "date")]' names_xp = '//*[@id="pendingTransactionTable"]//div[contains(@class, "merchant")]' amnts_xp = '//*[@id="pendingTransactionTable"]//div[contains(@class, "amount")]' else: dates_xp = '//*[@id="postedTransactionTable"]//div[contains(@class, "date")]/span' names_xp = '//*[@id="postedTransactionTable"]//div[contains(@class, "merchant")]' amnts_xp = '//*[@id="postedTransactionTable"]//div[contains(@class, "amount")]' amounts = [None] while amounts and any(a == None for a in amounts): dates = [parser.parse(x.text).isoformat() for x in f(dates_xp)] names = [x.text for x in f(names_xp)] # txtype = [x.text for x in f(pend + '/div[3]')] amounts = [utils.parse_dols(x.text) for x in f(amnts_xp)] return [ Transaction(tdate, desc, '', amt, not pending,) for tdate, desc, amt in zip(dates, names, amounts) ]
def get_transactions(self, pending=False): f = self.t.browser.driver.find_elements_by_xpath tbl = 'Pending' if pending else 'Posted' pend = '//*[@id="%s"]/table[contains(@class, "card-activity")]/tbody/tr/' % tbl tdates = [x.text for x in f(pend + '/td[2]')] # pdates = [x.text for x in f(pend + '/td[3]')] # types = [x.text for x in f(pend + '/td[4]')] descs = [x.text for x in f(pend + '/td[5]')] amounts = [utils.parse_dols(x.text) for x in f(pend + '/td[7]')] return [ Transaction(tdate, desc, '', amount, not pending,) for tdate, desc, amount in zip(tdates, descs, amounts) ]
def get_transactions(self, pending=False): f = self.t.browser.driver.find_elements_by_xpath tbl = 'Pending' if pending else 'Posted' pend = '//*[@id="%s"]/table[contains(@class, "card-activity")]/tbody/tr/' % tbl tdates = [x.text for x in f(pend + '/td[2]')] # pdates = [x.text for x in f(pend + '/td[3]')] # types = [x.text for x in f(pend + '/td[4]')] descs = [x.text for x in f(pend + '/td[5]')] amounts = [utils.parse_dols(x.text) for x in f(pend + '/td[7]')] return [ Transaction( tdate, desc, '', amount, not pending, ) for tdate, desc, amount in zip(tdates, descs, amounts) ]
def balance(self): xp = '//td[contains(text(), "Current balance")]/following-sibling::td' return utils.parse_dols(self.t.find_el_xp(xp).text)
def balance(self): xp = '//span[contains(text(), "Outstanding Balance")]/following-sibling::span' return utils.parse_dols(self.t.find_el_xp(xp).text)
def balance(self): xp = '//span[@id="current-balance-amount"]' return utils.parse_dols(self.t.find_el_xp(xp).text)