Skip to content

Instantly share code, notes, and snippets.

@Coder2012
Last active September 7, 2017 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Coder2012/cae91bc61329039cbd396fe73f23fdec to your computer and use it in GitHub Desktop.
Save Coder2012/cae91bc61329039cbd396fe73f23fdec to your computer and use it in GitHub Desktop.
XC League
curl "http://www.xcleague.com/xc/download.php?pilot=1&output=IGC&year=2008&xcFlightId=2008[1-100]" -o "#1.igc"
const puppeteer = require('puppeteer');
const url = 'http://www.gpsvisualizer.com/map_input?form=google';
(async() => {
const browser = await puppeteer.launch({headless: false});
const page = await browser.newPage();
page.setViewport({
width: 1400,
height: 800
})
await page.goto(url, {waitUntil: 'networkidle'});
//input:uploaded_file_1
const form = await page.$('form');
async function setSelectVal(sel, val) {
page.evaluate((data) => {
return document.querySelector(data.sel).value = data.val
}, {sel, val})
}
await setSelectVal('[name=trk_colorize]', 'altitude');
const check = await page.$('#new_window_checkbox');
await check.click();
const input = await page.$('input[name=uploaded_file_1]');
await input.uploadFile('2017/2479.igc');
await form.evaluate(form => form.submit());
const link = await page.$("a[href^='/display']");
console.log(link)
await link.click();
console.log('form submit');
//browser.close();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment