Last active
March 10, 2018 15:41
-
-
Save matisnape/7494084d592cfec0786da32f096bd753 to your computer and use it in GitHub Desktop.
Get sum of PEKA tickets value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# tPortmonetka - przejazdy | |
# range of positions: position() >= 100 and not(position() > 200) | |
# get last column | |
let cost_col = $x("//*[@id='dataTable']//tr[position() >= 100 and not(position() > 200)]/td[last()]/div"); | |
# parse to float | |
let float_cost_col = cost_col.map(el => parseFloat(el.innerText.replace(',', '.'))); | |
# sum | |
let cost_sum = float_cost_col.reduce((el1, el2) => el1 + el2, 0).toFixed(2); | |
# oneliner | |
calculate = $x("//*[@id='dataTable']//tr[position()>=13]/td[last()]/div").map(el => parseFloat(el.innerText.replace(',', '.'))).reduce((el1, el2) => el1 + el2, 0).toFixed(2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment