Created
November 13, 2018 15:44
-
-
Save kord123/e1c7c7c1a6acf4085b70df6e17ff5911 to your computer and use it in GitHub Desktop.
Run Chromium under puppeteer to mine Hadron coins
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
import * as puppeteer from 'puppeteer'; | |
import {Page} from "puppeteer"; | |
const email = "<your email>"; | |
const password = "<your password>"; | |
(async () => { | |
const browser = await puppeteer.launch({headless: false}); | |
const page: Page = await browser.newPage(); | |
await page.setViewport({width:1920, height: 1080}); | |
await page.goto("https://hadron.cloud/dashboard"); | |
await page.waitForXPath("//input[@name='email']").then(field => field.type(email)); | |
await page.waitForXPath("//input[@name='password']").then(field => field.type(password)); | |
await page.waitForXPath("//input[@type='submit']").then(button => button.click()); | |
await page.waitForXPath(`//div[@class='text' and text()='${email}']`).then(field => field.type(password)); | |
await page.goto("https://hadron.cloud/dashboard/mining_alpha"); | |
await page.waitForXPath("//div[@class='button toggle-mining' and text()='Start Mining']") | |
.then(button => button.click()); | |
console.log("8"); | |
setInterval(async () => { | |
const element = await page.waitForXPath("//div[@class='balance']/div[@class='value']"); | |
const text = await page.evaluate(div => div.textContent, element); | |
console.log(`${new Date().toLocaleString()}. Balance: ${text}`); | |
}, 60000); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment