Last active
November 2, 2019 09:56
-
-
Save marblejenka/4278e44c39f42229b277b4c4195255bd to your computer and use it in GitHub Desktop.
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
var self = this | |
setInterval(function($x){ | |
console.log('%s,%s,%s,%s,%s,%s,%s,%s,%s,%s', | |
$x('/html/body/div[3]/div[1]/div[1]/span[3]/span')[0].innerText, | |
$x('/html/body/div[3]/div[1]/div[2]/div[1]/div/p[3]/span')[0].innerText, | |
$x('/html/body/div[3]/div[1]/div[2]/div[2]/div/p[3]/span')[0].innerText, | |
$x('/html/body/div[3]/div[1]/div[2]/div[3]/div/p[3]/span')[0].innerText, | |
$x('/html/body/div[3]/div[1]/div[2]/div[4]/div/p[3]/span')[0].innerText, | |
$x('/html/body/div[3]/div[1]/div[2]/div[5]/div/p[3]/span')[0].innerText, | |
$x('/html/body/div[3]/div[1]/div[2]/div[6]/div/p[3]/span')[0].innerText, | |
$x('/html/body/div[3]/div[1]/div[2]/div[7]/div/p[3]/span')[0].innerText, | |
$x('/html/body/div[3]/div[1]/div[2]/div[8]/div/p[3]/span')[0].innerText, | |
$x('/html/body/div[3]/div[1]/div[2]/div[9]/div/p[3]/span')[0].innerText) | |
descreaseDatePCHomeMain.call(self) | |
},1000, $x); |
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
const puppeteer = require('puppeteer'); | |
const sys = require('sys'); | |
const fs = require('fs'); | |
(async () => { | |
const wsChromeEndpointurl = 'ws://127.0.0.1:9222/devtools/browser/31790567-f3b7-4405-b77b-c91a1ef4d440'; | |
const browser = await puppeteer.connect({ | |
browserWSEndpoint: wsChromeEndpointurl, | |
}); | |
const page = await browser.newPage(); | |
await page.goto('https://www.fitbit.com/weight', {waitUntil: 'networkidle0'}); | |
sys.log('page loaded') | |
var histo = fs.readFileSync('/Users/marblejenka/Desktop/sb-weight-dedup.csv', 'utf8'); | |
var records = histo.toString().split('\n'); | |
sys.log(records.length); | |
for(let i in records) { | |
await page.evaluate((records, i) => { | |
var embers = document.querySelectorAll("input[data-test-qa]"); | |
document.querySelector('#' + embers[2].id).value = records[i].split(',')[1]; | |
document.querySelector('#' + embers[3].id).value = records[i].split(',')[2]; | |
document.querySelector('#' + embers[4].id).value = records[i].split(',')[0]; | |
document.querySelector('#' + embers[4].id)._flatpickr.setDate(records[i].split(',')[0], true); | |
document.querySelector('#' + embers[2].id).select(); | |
document.querySelector('#' + embers[3].id).select(); | |
document.querySelector('#' + embers[4].id).select(); | |
}, records, i) | |
await page.click('button[class="button important"]'); | |
await page.waitFor(3000); | |
} | |
sys.log('finished') | |
})(); | |
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
from | |
https://healthcare.mb.softbank.jp/v3/web_home | |
to | |
https://www.fitbit.com/weight |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment