public void GetChromeBrowsersUrlTest()
        {
            foreach (Process process in Process.GetProcessesByName("chrome"))
            {
                string url = BrowserProcessHelpers.GetChromeUrl(process);
                if (url == null)
                {
                    continue;
                }

                Console.WriteLine("CH Url for '" + process.MainWindowTitle + "' is " + url);
            }
        }
        public void GetFireFoxBrowsersUrlTest()
        {
            foreach (Process process in Process.GetProcessesByName("firefox"))
            {
                string url = BrowserProcessHelpers.GetFirefoxUrl(process);
                if (url == null)
                {
                    continue;
                }

                Console.WriteLine("FF Url for '" + process.MainWindowTitle + "' is " + url);
            }
        }
        public void GetIEBrowsersUrlTest()
        {
            foreach (Process process in Process.GetProcessesByName("iexplore"))
            {
                string url = BrowserProcessHelpers.GetInternetExplorerUrl(process);
                if (url == null)
                {
                    continue;
                }

                Console.WriteLine("IE Url for '" + process.MainWindowTitle + "' is " + url);
            }
        }
        public void GetFireFoxTabTitle()
        {
            var title = BrowserProcessHelpers.GetWebBrowserTabTitle("firefox");

            Console.WriteLine(title);
        }
Exemple #5
0
        public override bool FindAd()
        {
            if (this.StopAllProcessing)
            {
                return(false);
            }
            Thread.Sleep(3000); // wait for few seconds before
            var bmpScreenBitmap = this.screenShotsManager.ScreenShot("shota.bmp");
            // this.BackgroundImage = bmpScreenBitmap;
            Point?foundBmpAt = Point.Empty;

            foreach (var toFindBitmap in this.toFindBitmaps)
            {
                foundBmpAt = this.screenShotsManager.Find(bmpScreenBitmap, toFindBitmap);
                if (foundBmpAt.HasValue)
                {
                    break;
                }
            }

            if (foundBmpAt.HasValue)
            {
                Logger.Info($"Found an advert");
                SmoothMouseMove.MoveMouse(
                    foundBmpAt.Value.X + this.rand.Next(10, 40),
                    foundBmpAt.Value.Y + this.rand.Next(20, 25),
                    2,
                    1);
                Thread.Sleep(2500);
                this.mouseSimulator.LeftButtonClick();

                Point?foundCaptcha = null;
                var   counter      = 0;
                do
                {
                    if (this.StopAllProcessing)
                    {
                        return(false);
                    }
                    counter++;
                    Thread.Sleep(1000);
                    SmoothMouseMove.MoveMouseInCircle(this.rand.Next(5, 200));
                    //this.keyboardSimulator.TextEntry();
                    SmoothMouseMove.MoveMouse(this.rand.Next(this.DisplayScreen.X, this.DisplayScreen.Width), this.rand.Next(this.DisplayScreen.Y, this.DisplayScreen.Height), 2, 2);
                    SmoothMouseMove.MoveMouseInCircle(this.rand.Next(50, 100));

                    var webBrowserTabTitle = BrowserProcessHelpers.GetWebBrowserTabTitle("firefox");
                    if (webBrowserTabTitle.Contains("Internal Server Error"))
                    {
                        this.keyboardSimulator.ModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_W);
                        Logger.Info($" Keyboard Close");
                        return(true);
                    }
                }while (!this.MegaAdCaptchaSolve(out foundCaptcha) && counter < 7);

                if (foundCaptcha.HasValue)
                {
                    SmoothMouseMove.MoveMouse(foundCaptcha.Value.X + this.rand.Next(10, 40), foundCaptcha.Value.Y + this.rand.Next(10, 24), 2, 2);
                    Thread.Sleep(50);
                    this.mouseSimulator.LeftButtonClick();
                    Thread.Sleep(1000);
                    this.keyboardSimulator.ModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_W);
                    Logger.Info($" Keyboard Close");
                }
            }
            else
            {
                Logger.Info($"No Ad Found ...");
                return(false);
            }
            return(true);
        }