示例#1
0
        public HtmlDocument GetHtml()
        {
            ChromeNav.OpenElements(_InputSimulator);
            ChromeNav.CopyHTML(_InputSimulator);
            string     clipboardText = Clipboard.GetText(TextDataFormat.Text);
            WebBrowser browser       = new WebBrowser();

            browser.ScriptErrorsSuppressed = true; //not necessesory you can remove it
            browser.DocumentText           = clipboardText;
            browser.Document.OpenNew(true);
            browser.Document.Write(clipboardText);
            browser.Refresh();
            return(browser.Document);
        }
示例#2
0
        public static List <string> GetFollowing(InputSimulator sim, string botName)
        {
            List <string> result    = new List <string>();
            List <string> newResult = new List <string>();

            ChromeNav.OpenConsole(sim);
            Point followersPoint = ChromeNav.GetLocationOfElementByHref(sim, $"https://www.instagram.com/{botName}/following/");

            ChromeNav.LeftClick(followersPoint);
            //can change to point to first follower.
            Cursor.Position = new Point(650, 500);
            System.Threading.Thread.Sleep(1000);
            sim.Mouse.VerticalScroll(-5);
            int scrollAmount = 30;

            for (int i = 0; i < scrollAmount; i++)
            {
                System.Threading.Thread.Sleep(500);
                sim.Mouse.VerticalScroll(-5);
            }

            newResult = GetElementsByClassName(sim, "notranslate");
            while (newResult.Count != result.Count)
            {
                result          = newResult;
                Cursor.Position = new Point(650, 500);
                scrollAmount   *= 2;
                for (int i = 0; i < scrollAmount; i++)
                {
                    System.Threading.Thread.Sleep(500);
                    sim.Mouse.VerticalScroll(-5);
                }
                newResult = GetElementsByClassName(sim, "notranslate");
            }
            return(result);
        }