Last active
January 19, 2022 09:45
-
-
Save EvanBurbidge/c9ed1a92543baa0936a82f31df68f06a to your computer and use it in GitHub Desktop.
An automated selenium script for getting hi tokens
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 { Builder, By } = require('selenium-webdriver'); | |
(async function hi() { | |
let driver = await new Builder().forBrowser('chrome').build(); | |
try { | |
await driver.get('https://web.hi.com'); | |
const areaCode = await driver.findElement(By.css('.areaCode')); | |
await areaCode.click(); | |
await driver.sleep(500); | |
const search = await driver.findElement(By.css('.searchs .uni-input-wrapper .uni-input-input')); | |
await search.sendKeys(YOUR_COUNTRY_HERE); | |
await driver.sleep(4000); | |
const areaCodes = await driver.findElement(By.css(".areaCodeList .code")); | |
await areaCodes.click(); | |
await driver.sleep(2000); | |
const input = await driver.findElement(By.css('.amount-input input')); | |
await driver.sleep(1000) | |
await input.sendKeys(YOUR_PHONE_NUMBER_HERE); | |
await driver.sleep(3000) | |
const button = await driver.findElement(By.xpath('/html/body/uni-app/uni-page/uni-page-wrapper/uni-page-body/uni-view/uni-view[2]/uni-view/uni-view[9]/uni-button')); | |
await driver.sleep(1000) | |
await button.click(); | |
await driver.sleep(2000); | |
const password = await driver.findElement(By.css('.phoneInput input')); | |
await driver.sleep(1000) | |
await password.sendKeys(YOUR_PASSWORD_HERE); | |
const login = await driver.findElement(By.css('.login-nextBtn')); | |
await driver.sleep(1000); | |
await login.click(); | |
await driver.sleep(1000); | |
await driver.executeScript(function () { | |
localStorage.setItem("isGuideShowed", '{\"type\":"boolean",\"data\":true}'); | |
}); | |
await driver.navigate().refresh() | |
await driver.sleep(1000); | |
const images = await driver.findElements(By.css('img.sign-img')); | |
await images[2].click(); | |
await driver.sleep(2000); | |
const contentListItems = await driver.findElements(By.css('.content-list')); | |
await contentListItems[0].click(); | |
await driver.sleep(2000); | |
const submit = await driver.findElement(By.css('uni-view.a-agree.active')); | |
await submit.click(); | |
await driver.sleep(2000); | |
console.log('DONE!'); | |
} finally { | |
await driver.quit(); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment