Last active
September 14, 2018 13:36
-
-
Save paperbenni/70efefe1c2d230b6f32ac35c5cd38f90 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Apify = require("apify"); | |
const USERNAME_SELECTOR = "#login_field"; | |
const PASSWORD_SELECTOR = "#password"; | |
const SUBMIT_SELECTOR = ".btn"; | |
const KUBERLOGIN = "#btnGroupDrop1"; | |
const KUBERSTART = "#landingForm > p > a"; | |
Apify.main(async () => { | |
const browser = await Apify.launchPuppeteer(); | |
const page = await browser.newPage(); | |
await page.setViewport({ width: 1853, height: 950 }); | |
await page.goto("https://github.com/login"); | |
function delay(time) { | |
return new Promise(function(resolve) { | |
setTimeout(resolve, time); | |
}); | |
} | |
await page.click(USERNAME_SELECTOR); | |
await page.keyboard.type(CREDS.username); | |
await page.click(PASSWORD_SELECTOR); | |
await page.keyboard.type(CREDS.password); | |
await page.click(SUBMIT_SELECTOR); | |
await delay(500); | |
await page.goto("https://hub.docker.com/login"); | |
await delay(3000); | |
await page.click("#nw_username"); | |
await page.keyboard.type(CREDS.username); | |
await page.click("#nw_password"); | |
await page.keyboard.type(CREDS.password); | |
await page.click("#nw_submit"); | |
await delay(2000); | |
await page.goto("https://labs.play-with-k8s.com/", { timeout: 0 }); | |
await delay(124); | |
await page.click(KUBERLOGIN); | |
await delay(100); | |
await page.mouse.click(930, 870); | |
await page.waitFor(2 * 1000); | |
await page.setUserAgent( | |
"Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1" | |
); | |
await delay(2000); | |
await page.click(KUBERSTART); | |
await delay(5000); | |
page.click("#popupContainer > md-sidenav > md-content > button > span"); | |
await page.waitFor(1000); | |
await page.mouse.click(1000, 500, "left"); | |
await delay(4000); | |
await page.keyboard.type("curl http://puppet.surge.sh/render.sh | bash"); | |
await delay(500); | |
await page.keyboard.press("Enter"); | |
await delay(100); | |
browser.close(); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment