finish
This commit is contained in:
parent
cbe8765203
commit
f7d9396150
|
@ -3,14 +3,18 @@
|
||||||
[clojure.java.shell :refer [sh]]
|
[clojure.java.shell :refer [sh]]
|
||||||
[etaoin.keys :as k]))
|
[etaoin.keys :as k]))
|
||||||
|
|
||||||
(def driver (e/chrome {:headless true
|
(def driver (e/chrome {;:headless true
|
||||||
|
:user-agent "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"
|
||||||
:args ["--disable-blink-features=AutomationControlled" "--maximize"]
|
:args ["--disable-blink-features=AutomationControlled" "--maximize"]
|
||||||
|
:size [1920 1080]
|
||||||
:prefs {:profile.default_content_setting_values.automatic_downloads 1}}))
|
:prefs {:profile.default_content_setting_values.automatic_downloads 1}}))
|
||||||
;:download-dir "./documents/"
|
;:download-dir "./documents/"
|
||||||
|
|
||||||
(defn download-csv
|
(defn download-csv
|
||||||
[]
|
[]
|
||||||
(e/js-execute driver "Object.defineProperty(navigator, 'webdriver', {get: () => undefined})")
|
(e/js-execute driver "Object.defineProperty(navigator, 'webdriver', {get: () => undefined})")
|
||||||
|
#_(e/js-execute driver "window.chrome = { app: { isInstalled: false, InstallState: { DISABLED: disabled, INSTALLED: installed, NOT_INSTALLED: not_installed }, RunningState: { CANNOT_RUN: cannot_run, READY_TO_RUN: ready_to_run, RUNNING: running } } }")
|
||||||
|
(e/js-execute driver "const originalQuery = window.navigator.permissions.query; return window.navigator.permissions.query = (parameters) => ( parameters.name === 'notifications' ? Promise.resolve({ state: Notification.permission }) : originalQuery(parameters));")
|
||||||
(e/go driver "https://ib.nab.com.au/nabib/index.jsp")
|
(e/go driver "https://ib.nab.com.au/nabib/index.jsp")
|
||||||
(e/wait-visible driver [{:id :username}])
|
(e/wait-visible driver [{:id :username}])
|
||||||
; Don't advertise that we're a bot
|
; Don't advertise that we're a bot
|
||||||
|
@ -19,23 +23,29 @@
|
||||||
(e/fill driver {:id :password} k/enter)
|
(e/fill driver {:id :password} k/enter)
|
||||||
(e/wait 4)
|
(e/wait 4)
|
||||||
(e/click driver {:tag :button :id :hamburger-btn})
|
(e/click driver {:tag :button :id :hamburger-btn})
|
||||||
(e/click-el driver (e/query driver {:css "li.selected>button"}))
|
|
||||||
(e/click-el driver (e/query driver {:tag :a :fn/text "Transaction history"}))
|
(e/click-el driver (e/query driver {:tag :a :fn/text "Transaction history"}))
|
||||||
(e/wait 4)
|
(e/wait 4)
|
||||||
; Update to last 7 days
|
; Update to last 7 days
|
||||||
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"#dropdown-toggle-button-DateDropdown\").click()")
|
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"#dropdown-toggle-button-DateDropdown\").click()")
|
||||||
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"#dropdown-listbox-DateDropdown-0\").click()")
|
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"#dropdown-listbox-DateDropdown-0\").click()")
|
||||||
|
; update twice to be sure
|
||||||
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"div > div > div > div.Containerstyle__StyledWrapper-sc-10ei1r0-0.dnudTa > div > div > div > div.StyledScreenView-jlloJx.gsnnCS > form > div > div:nth-child(3) > div > button\").click()")
|
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"div > div > div > div.Containerstyle__StyledWrapper-sc-10ei1r0-0.dnudTa > div > div > div > div.StyledScreenView-jlloJx.gsnnCS > form > div > div:nth-child(3) > div > button\").click()")
|
||||||
(e/wait 2)
|
(e/wait 6)
|
||||||
|
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"div > div > div > div.Containerstyle__StyledWrapper-sc-10ei1r0-0.dnudTa > div > div > div > div.StyledScreenView-jlloJx.gsnnCS > form > div > div:nth-child(3) > div > button\").click()")
|
||||||
|
(e/wait 6)
|
||||||
; Download checking file
|
; Download checking file
|
||||||
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"#export-button > div\").click()")
|
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"#export-button > div\").click()")
|
||||||
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"div > div > div > div:nth-child(2) > div > div > div > div > div.StyledScreenView-jlloJx.gsnnCS > div > div > div > div.StyledTopRow-cijGbF.StyledExportCol-fYxmhQ.ibndGm.cAjmIO.sc-dkPtRN.Colstyle__StyledCol-sc-1evc4kf-0.ketKXK.fqofCs > div > div > div > ul > li:nth-child(1) > button\").click()")
|
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"div > div > div > div:nth-child(2) > div > div > div > div > div.StyledScreenView-jlloJx.gsnnCS > div > div > div > div.StyledTopRow-cijGbF.StyledExportCol-fYxmhQ.ibndGm.cAjmIO.sc-dkPtRN.Colstyle__StyledCol-sc-1evc4kf-0.ketKXK.fqofCs > div > div > div > ul > li:nth-child(1) > button\").click()")
|
||||||
(e/wait 3)
|
(e/wait 3)
|
||||||
; Download savings file
|
; change to savings file
|
||||||
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"#dropdown-toggle-button-accountsListDropdown > div\").click()")
|
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"#dropdown-toggle-button-accountsListDropdown > div\").click()")
|
||||||
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"#dropdown-listbox-accountsListDropdown-1 > div > div > div.AccountCardstyle__StyledAccountTypeContainer-sc-16p3i3w-1.cLXpwB\").click()")
|
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"#dropdown-listbox-accountsListDropdown-1 > div > div > div.AccountCardstyle__StyledAccountTypeContainer-sc-16p3i3w-1.cLXpwB\").click()")
|
||||||
|
; update twice to be sure
|
||||||
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"div > div > div > div.Containerstyle__StyledWrapper-sc-10ei1r0-0.dnudTa > div > div > div > div.StyledScreenView-jlloJx.gsnnCS > form > div > div:nth-child(3) > div > button\").click()")
|
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"div > div > div > div.Containerstyle__StyledWrapper-sc-10ei1r0-0.dnudTa > div > div > div > div.StyledScreenView-jlloJx.gsnnCS > form > div > div:nth-child(3) > div > button\").click()")
|
||||||
(e/wait 3)
|
(e/wait 6)
|
||||||
|
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"div > div > div > div.Containerstyle__StyledWrapper-sc-10ei1r0-0.dnudTa > div > div > div > div.StyledScreenView-jlloJx.gsnnCS > form > div > div:nth-child(3) > div > button\").click()")
|
||||||
|
(e/wait 6)
|
||||||
|
; Download savings file
|
||||||
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"#export-button > div\").click()")
|
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"#export-button > div\").click()")
|
||||||
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"div > div > div > div:nth-child(2) > div > div > div > div > div.StyledScreenView-jlloJx.gsnnCS > div > div > div > div.StyledTopRow-cijGbF.StyledExportCol-fYxmhQ.ibndGm.cAjmIO.sc-dkPtRN.Colstyle__StyledCol-sc-1evc4kf-0.ketKXK.fqofCs > div > div > div > ul > li:nth-child(1) > button\").click()")
|
(e/js-execute driver "document.querySelector(\"#bodyContent > miniapp-transactions\").shadowRoot.querySelector(\"div > div > div > div:nth-child(2) > div > div > div > div > div.StyledScreenView-jlloJx.gsnnCS > div > div > div > div.StyledTopRow-cijGbF.StyledExportCol-fYxmhQ.ibndGm.cAjmIO.sc-dkPtRN.Colstyle__StyledCol-sc-1evc4kf-0.ketKXK.fqofCs > div > div > div > ul > li:nth-child(1) > button\").click()")
|
||||||
(e/wait 3)
|
(e/wait 3)
|
||||||
|
|
|
@ -385,5 +385,5 @@
|
||||||
(mapv write-transaction-to-file (drop-last (take-csv csv)))
|
(mapv write-transaction-to-file (drop-last (take-csv csv)))
|
||||||
(mapv write-transaction-to-file-savings (drop-last (take-csv csv))))
|
(mapv write-transaction-to-file-savings (drop-last (take-csv csv))))
|
||||||
(write-accounts beancount-file)
|
(write-accounts beancount-file)
|
||||||
#_(assert-balance (last (take-csv csv)) checking?)
|
(assert-balance (last (take-csv csv)) checking?)
|
||||||
(reset! new-accounts #{}))
|
(reset! new-accounts #{}))
|
||||||
|
|
Loading…
Reference in a new issue