File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -358,7 +358,22 @@ private async Task<bool> TryFastUpgrade(Account acc)
358
358
359
359
var elementIframe = acc . Wb . Driver . FindElement ( By . XPath ( nodeIframe . XPath ) ) ;
360
360
Actions act = new Actions ( acc . Wb . Driver ) ;
361
- act . MoveToElement ( elementIframe ) . Click ( ) . Build ( ) . Perform ( ) ;
361
+ var action = act . MoveToElement ( elementIframe ) . Click ( ) . Build ( ) ;
362
+ action . Perform ( ) ;
363
+
364
+ await Task . Delay ( rand . Next ( 10000 , 15000 ) ) ;
365
+ var handles = acc . Wb . Driver . WindowHandles ;
366
+
367
+ while ( handles . Count > 1 )
368
+ {
369
+ acc . Logger . Information ( "Detect auto play ads, bot maybe pause ads. Great work Travian Devs" ) ;
370
+ var current = acc . Wb . Driver . CurrentWindowHandle ;
371
+ var other = acc . Wb . Driver . WindowHandles . FirstOrDefault ( x => ! x . Equals ( current ) ) ;
372
+ acc . Wb . Driver . SwitchTo ( ) . Window ( other ) ;
373
+ acc . Wb . Driver . Close ( ) ;
374
+ acc . Wb . Driver . SwitchTo ( ) . Window ( current ) ;
375
+ action . Perform ( ) ;
376
+ }
362
377
}
363
378
364
379
acc . Logger . Information ( "Clicked play button, if ads doesn't play please click to help bot" ) ;
You can’t perform that action at this time.
0 commit comments