def download(self, account): wait_for(self.driver, By.PARTIAL_LINK_TEXT, account.site_key) self.driver.find_element_by_partial_link_text(account.site_key).click() wait_for(self.driver, By.ID, "filterDropDown-button") self.driver.find_element_by_id("filterDropDown-button").click() self.driver.find_element_by_id("filterDropDown-menu").send_keys( Keys.PAGE_DOWN) self.driver.find_element_by_id("filterDropDown-menu").send_keys( Keys.PAGE_DOWN) self.driver.find_element_by_id("filterDropDown-menu").send_keys( Keys.PAGE_DOWN) self.driver.find_element_by_id("filterDropDown-menu").send_keys( Keys.PAGE_DOWN) self.driver.find_element_by_id("filterDropDown-menu").send_keys( Keys.PAGE_DOWN) self.driver.find_element_by_id("filterDropDown-menu").send_keys( Keys.PAGE_DOWN) self.driver.find_element_by_id("filterDropDown-menu-option-10").click() wait_for(self.driver, By.LINK_TEXT, 'Download Transactions') self.driver.find_element_by_partial_link_text( 'Download Transactions').click() script = """$('#FormatDropDown').find('option[value="OFX"]').attr('selected', true)""" wait_for(self.driver, By.LINK_TEXT, 'Next') self.driver.execute_script(script) self.driver.find_element_by_id('DownLoadActivity_Next').click() wait_for(self.driver, By.LINK_TEXT, 'Download') return wait_for_file( self.dl_path, lambda: self.driver.find_element_by_id( 'DownLoadActivity_Process').click())
def download(self, account): self.driver.switch_to.window(self.driver.window_handles[0]) self.driver.switch_to.frame(0) self.driver.switch_to.frame(0) self.driver.switch_to.frame(1) self.driver.switch_to.frame(0) self.driver.switch_to.frame(0) parser = etree.HTMLParser(encoding='utf-8') doc = etree.fromstring(self.driver.page_source, parser) balance = doc.xpath('//*[contains(text(), "Portfolio Total")]/text()') balance = float(balance[0].strip().replace('Portfolio Total: $', '').replace(',','')) self._statement = Statement(account, [], balance) self.driver.find_element_by_partial_link_text(account.site_key).click() self.driver.switch_to.frame(0) self.driver.find_element_by_id("pageTitledwnArr").click() self.driver.switch_to.window(self.driver.window_handles[0]) self.driver.switch_to.frame(0) self.driver.switch_to.frame(0) self.driver.switch_to.frame(9) self.driver.find_element_by_partial_link_text("Your Default").click() self.driver.switch_to.window(self.driver.window_handles[0]) self.driver.switch_to.frame(0) self.driver.switch_to.frame(0) self.driver.switch_to.frame(1) self.driver.switch_to.frame(0) self.driver.switch_to.frame(0) self.driver.switch_to.frame(1) wait_for(self.driver, By.PARTIAL_LINK_TEXT, 'Important History Information') return wait_for_file(self.dl_path, lambda:self.driver.find_element_by_id("export").click())
def download(self, account): wait_for(self.driver, By.PARTIAL_LINK_TEXT, account.site_key) self.driver.find_element_by_partial_link_text(account.site_key).click() parser = etree.HTMLParser(encoding='utf-8') doc = etree.fromstring(self.driver.page_source, parser) balance = doc.xpath( "//th[text()='Principal balance']/../td/text()")[0].replace( '$', '').replace(',', '') self.driver.find_element_by_partial_link_text( 'See transaction history').click() doc = etree.fromstring(self.driver.page_source, parser) transaction_content = doc.xpath("//div[@id='GridContainer1']//tr")[1:] transactions = [] for tr in transaction_content: date = datetime.datetime.strptime(tr[0].text, '%m/%d/%Y') description = tr[1].text amount = tr[2].text.replace('$', '').replace(',', '') transactions.append({ 'posted': date, 'description': description, 'amount': amount }) return Statement(account, transactions, balance)
def download(self, account): wait_for(self.driver, By.LINK_TEXT, "Payment Activity") self.driver.get('https://services2.capitalone.com/accounts/transactions/export') wait_for(self.driver, By.LINK_TEXT, "Pending transactions") today = datetime.datetime.today() end_date = datetime.datetime.strftime(today, '%Y-%m-%d') download_url = 'https://servicing.capitalone.com/c1/accounts/download.ashx?index=1&from=2015-01-01&to={}&type=ofx'.format(end_date) return wait_for_file(self.dl_path, lambda:self.driver.get(download_url))
def download(self, account): wait_for(self.driver, By.LINK_TEXT, "Change Email") parser = etree.HTMLParser(encoding='utf-8') doc = etree.fromstring(self.driver.page_source, parser) amounts = doc.xpath("//div[contains(@class, 'currency')]/text()") total = 0.0 for amount in amounts: f_amount = float(unicode(amount).encode('ascii', 'ignore').replace("$", '').replace(',','')) total += f_amount return Statement(account, [], total)
def download(self, account): wait_for(self.driver, By.LINK_TEXT, "Change Email") parser = etree.HTMLParser(encoding='utf-8') doc = etree.fromstring(self.driver.page_source, parser) amounts = doc.xpath("//div[contains(@class, 'currency')]/text()") total = 0.0 for amount in amounts: f_amount = float( unicode(amount).encode('ascii', 'ignore').replace("$", '').replace(',', '')) total += f_amount return Statement(account, [], total)
def login(self, account): super(Citibank, self).login(account) wait_for(self.driver, By.LINK_TEXT, "Forgot User ID or Password?") time.sleep(2) try: self.driver.find_element_by_id("usernameMasked").click() self.driver.find_element_by_id("usernameMasked").send_keys(account.username) except: self.driver.find_element_by_id("username").click() self.driver.find_element_by_id("username").send_keys(account.username) self.driver.find_element_by_id("pwd").send_keys(account.password) self.driver.find_element_by_id("pwd").submit()
def download(self, account): self.driver.get( "https://client.schwab.com/secure/cc/accounts/balances") self.driver.find_element_by_id("accountSelector").click() wait_for(self.driver, By.PARTIAL_LINK_TEXT, account.site_key) self.driver.find_element_by_partial_link_text(account.site_key).click() parser = etree.HTMLParser(encoding='utf-8') doc = etree.fromstring(self.driver.page_source, parser) balance = doc.xpath( '//*[text()="Total"]/../following-sibling::td/*/text()') balance = balance[0].replace('$', '').replace(',', '') self._statement = Statement(account, [], balance) time.sleep(2) self.driver.get("https://client.schwab.com/secure/cc/accounts/history") self.driver.find_element_by_id("accountSelector").click() wait_for(self.driver, By.PARTIAL_LINK_TEXT, account.site_key) self.driver.find_element_by_partial_link_text(account.site_key).click() wait_for(self.driver, By.LINK_TEXT, "Edit Filter") self.driver.find_element_by_partial_link_text("Export").click() time.sleep(2) self.driver.switch_to.window(self.driver.window_handles[1]) wait_for(self.driver, By.LINK_TEXT, "OK") return wait_for_file( self.dl_path, lambda: self.driver.find_element_by_partial_link_text("OK").click( ))
def login(self, account): super(Citibank, self).login(account) wait_for(self.driver, By.LINK_TEXT, "Forgot User ID or Password?") time.sleep(2) try: self.driver.find_element_by_id("usernameMasked").click() self.driver.find_element_by_id("usernameMasked").send_keys( account.username) except: self.driver.find_element_by_id("username").click() self.driver.find_element_by_id("username").send_keys( account.username) self.driver.find_element_by_id("pwd").send_keys(account.password) self.driver.find_element_by_id("pwd").submit()
def download(self, account): wait_for(self.driver, By.PARTIAL_LINK_TEXT, account.site_key) self.driver.find_element_by_partial_link_text(account.site_key).click() parser = etree.HTMLParser(encoding='utf-8') doc = etree.fromstring(self.driver.page_source, parser) balance = doc.xpath("//th[text()='Principal balance']/../td/text()")[0].replace('$', '').replace(',', '') self.driver.find_element_by_partial_link_text('See transaction history').click() doc = etree.fromstring(self.driver.page_source, parser) transaction_content = doc.xpath("//div[@id='GridContainer1']//tr")[1:] transactions = [] for tr in transaction_content: date = datetime.datetime.strptime(tr[0].text, '%m/%d/%Y') description = tr[1].text amount = tr[2].text.replace('$', '').replace(',', '') transactions.append({'posted':date, 'description':description, 'amount':amount}) return Statement(account, transactions, balance)
def download(self, account): wait_for(self.driver, By.PARTIAL_LINK_TEXT, account.site_key) self.driver.find_element_by_partial_link_text(account.site_key).click() wait_for(self.driver, By.ID, "filterDropDown-button") self.driver.find_element_by_id("filterDropDown-button").click() self.driver.find_element_by_id("filterDropDown-menu").send_keys(Keys.PAGE_DOWN) self.driver.find_element_by_id("filterDropDown-menu").send_keys(Keys.PAGE_DOWN) self.driver.find_element_by_id("filterDropDown-menu").send_keys(Keys.PAGE_DOWN) self.driver.find_element_by_id("filterDropDown-menu").send_keys(Keys.PAGE_DOWN) self.driver.find_element_by_id("filterDropDown-menu").send_keys(Keys.PAGE_DOWN) self.driver.find_element_by_id("filterDropDown-menu").send_keys(Keys.PAGE_DOWN) self.driver.find_element_by_id("filterDropDown-menu-option-10").click() wait_for(self.driver, By.LINK_TEXT, 'Download Transactions') self.driver.find_element_by_partial_link_text('Download Transactions').click() script = """$('#FormatDropDown').find('option[value="OFX"]').attr('selected', true)""" wait_for(self.driver, By.LINK_TEXT, 'Next') self.driver.execute_script(script) self.driver.find_element_by_id('DownLoadActivity_Next').click() wait_for(self.driver, By.LINK_TEXT, 'Download') return wait_for_file(self.dl_path, lambda:self.driver.find_element_by_id('DownLoadActivity_Process').click())
def download(self, account): self.driver.get("https://client.schwab.com/secure/cc/accounts/balances") self.driver.find_element_by_id("accountSelector").click() wait_for(self.driver, By.PARTIAL_LINK_TEXT, account.site_key) self.driver.find_element_by_partial_link_text(account.site_key).click() parser = etree.HTMLParser(encoding='utf-8') doc = etree.fromstring(self.driver.page_source, parser) balance = doc.xpath('//*[text()="Total"]/../following-sibling::td/*/text()') balance = balance[0].replace('$', '').replace(',', '') self._statement = Statement(account, [], balance) time.sleep(2) self.driver.get("https://client.schwab.com/secure/cc/accounts/history") self.driver.find_element_by_id("accountSelector").click() wait_for(self.driver, By.PARTIAL_LINK_TEXT, account.site_key) self.driver.find_element_by_partial_link_text(account.site_key).click() wait_for(self.driver, By.LINK_TEXT, "Edit Filter") self.driver.find_element_by_partial_link_text("Export").click() time.sleep(2) self.driver.switch_to.window(self.driver.window_handles[1]) wait_for(self.driver, By.LINK_TEXT, "OK") return wait_for_file(self.dl_path, lambda:self.driver.find_element_by_partial_link_text("OK").click())
def download(self, account): wait_for(self.driver, By.LINK_TEXT, "Link an Account") script = """$('[key="ExpandAllLabel"]').click()""" self.driver.execute_script(script) time.sleep(2) wait_for(self.driver, By.LINK_TEXT, account.site_key) self.driver.find_element_by_partial_link_text(account.site_key).click() time.sleep(2) wait_for(self.driver, By.ID, "filterDropDown-button") self.driver.find_element_by_id("filterDropDown-button").click() self.driver.find_element_by_id("filterDropDown-menu-option-2").click() wait_for(self.driver, By.LINK_TEXT, 'Download Transactions') self.driver.find_element_by_partial_link_text( 'Download Transactions').click() script = """$('#FormatDropDown').find('option[value="OFX"]').attr('selected', true)""" wait_for(self.driver, By.LINK_TEXT, 'Next') self.driver.execute_script(script) self.driver.find_element_by_id('DownLoadActivity_Next').click() wait_for(self.driver, By.LINK_TEXT, 'Download') return wait_for_file( self.dl_path, lambda: self.driver.find_element_by_id( 'DownLoadActivity_Process').click())
def download(self, account): wait_for(self.driver, By.LINK_TEXT, "Link an Account") script = """$('[key="ExpandAllLabel"]').click()""" self.driver.execute_script(script) time.sleep(2) wait_for(self.driver, By.LINK_TEXT, account.site_key) self.driver.find_element_by_partial_link_text(account.site_key).click() time.sleep(2) wait_for(self.driver, By.ID, "filterDropDown-button") self.driver.find_element_by_id("filterDropDown-button").click() self.driver.find_element_by_id("filterDropDown-menu-option-2").click() wait_for(self.driver, By.LINK_TEXT, 'Download Transactions') self.driver.find_element_by_partial_link_text('Download Transactions').click() script = """$('#FormatDropDown').find('option[value="OFX"]').attr('selected', true)""" wait_for(self.driver, By.LINK_TEXT, 'Next') self.driver.execute_script(script) self.driver.find_element_by_id('DownLoadActivity_Next').click() wait_for(self.driver, By.LINK_TEXT, 'Download') return wait_for_file(self.dl_path, lambda:self.driver.find_element_by_id('DownLoadActivity_Process').click())
def download(self, account): wait_for(self.driver, By.LINK_TEXT, 'See activity') return wait_for_file(self.dl_path, lambda:self.driver.get(account.download_url))
def download(self, account): wait_for(self.driver, By.LINK_TEXT, 'See activity') return wait_for_file(self.dl_path, lambda: self.driver.get(account.download_url))