@@ -8,6 +8,7 @@ const path = require("path")
8
8
const FormData = require ( "form-data" )
9
9
const proxy = require ( "selenium-webdriver/proxy" )
10
10
const proxyChain = require ( "proxy-chain" )
11
+ const { ALL } = require ( "dns" )
11
12
require ( "dotenv" ) . config ( )
12
13
13
14
const extensionId = "caacbgbklghmpodbdafajbgdnegacfmo"
@@ -227,12 +228,8 @@ async function getProxyIpInfo(driver, proxyUrl) {
227
228
await driver . findElement ( passwordInput ) . sendKeys ( PASSWORD )
228
229
await driver . findElement ( loginButton ) . click ( )
229
230
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 )
236
233
237
234
console . log ( "-> Logged in! Waiting for open extension..." )
238
235
@@ -281,22 +278,19 @@ async function getProxyIpInfo(driver, proxyUrl) {
281
278
console . log ( "-> Gradient is available in your region. " )
282
279
}
283
280
284
- await driver . wait (
285
- until . elementLocated ( By . xpath ( '//*[contains(text(), "Today\'s Taps")]' ) ) ,
286
- 30000
287
- )
288
-
289
281
// <div class="absolute mt-3 right-0 z-10">
290
282
const supportStatus = await driver
291
283
. findElement ( By . css ( ".absolute.mt-3.right-0.z-10" ) )
292
284
. getText ( )
293
285
294
- const dom = await driver
295
- . findElement ( By . css ( "html" ) )
296
- . getAttribute ( "outerHTML" )
297
- fs . writeFileSync ( "dom.html" , dom )
298
286
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
+ }
300
294
301
295
console . log ( "-> Status:" , supportStatus )
302
296
@@ -350,7 +344,8 @@ async function getProxyIpInfo(driver, proxyUrl) {
350
344
console . error ( "-> Error report generated!" )
351
345
console . error ( fs . readFileSync ( "error.log" ) . toString ( ) )
352
346
driver . quit ( )
353
- process . exit ( 1 )
354
347
}
348
+
349
+ process . exit ( 1 )
355
350
}
356
351
} ) ( )
0 commit comments