Skip to content

Commit 7b74bb0

Browse files
committed
bugfix
1 parent f3d5f06 commit 7b74bb0

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
.env
33
proxies.txt
44
error.log
5-
dom.html
5+
*.html
66
node_modules
77
*.png

app.js

+12-17
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const path = require("path")
88
const FormData = require("form-data")
99
const proxy = require("selenium-webdriver/proxy")
1010
const proxyChain = require("proxy-chain")
11+
const { ALL } = require("dns")
1112
require("dotenv").config()
1213

1314
const extensionId = "caacbgbklghmpodbdafajbgdnegacfmo"
@@ -227,12 +228,8 @@ async function getProxyIpInfo(driver, proxyUrl) {
227228
await driver.findElement(passwordInput).sendKeys(PASSWORD)
228229
await driver.findElement(loginButton).click()
229230

230-
await driver.wait(
231-
until.elementLocated(
232-
By.xpath('//*[contains(text(), "Copy Referral Link")]')
233-
),
234-
30000
235-
)
231+
// wait until find <a href="/dashboard/setting">
232+
await driver.wait(until.elementLocated(By.css('a[href="/dashboard/setting"]')), 30000)
236233

237234
console.log("-> Logged in! Waiting for open extension...")
238235

@@ -281,22 +278,19 @@ async function getProxyIpInfo(driver, proxyUrl) {
281278
console.log("-> Gradient is available in your region. ")
282279
}
283280

284-
await driver.wait(
285-
until.elementLocated(By.xpath('//*[contains(text(), "Today\'s Taps")]')),
286-
30000
287-
)
288-
289281
// <div class="absolute mt-3 right-0 z-10">
290282
const supportStatus = await driver
291283
.findElement(By.css(".absolute.mt-3.right-0.z-10"))
292284
.getText()
293285

294-
const dom = await driver
295-
.findElement(By.css("html"))
296-
.getAttribute("outerHTML")
297-
fs.writeFileSync("dom.html", dom)
298286

299-
await takeScreenshot(driver, "status.png")
287+
if (ALLOW_DEBUG) {
288+
const dom = await driver
289+
.findElement(By.css("html"))
290+
.getAttribute("outerHTML")
291+
fs.writeFileSync("dom.html", dom)
292+
await takeScreenshot(driver, "status.png")
293+
}
300294

301295
console.log("-> Status:", supportStatus)
302296

@@ -350,7 +344,8 @@ async function getProxyIpInfo(driver, proxyUrl) {
350344
console.error("-> Error report generated!")
351345
console.error(fs.readFileSync("error.log").toString())
352346
driver.quit()
353-
process.exit(1)
354347
}
348+
349+
process.exit(1)
355350
}
356351
})()

0 commit comments

Comments
 (0)