Beispiel #1
0
        public void SetUpForPerformanceLogs()
        {
            //http://chromedriver.chromium.org/logging/performance-log
            //Кроме того, драйвер для браузера Chrome позволяет получить информация о производительности
            //тех операций, которые выполняются внутри браузера => Performance log прочитать.
            //По умолчанию эта фозможность отключена, но ее можно активировать, с помощью Capabilities
            var perfLogsPref = new ChromePerformanceLoggingPreferences();

            perfLogsPref.AddTracingCategory("devtools.timeline");
            var options = new ChromeOptions();

            options.PerformanceLoggingPreferences = perfLogsPref;
            options.SetLoggingPreference("performance", LogLevel.All);

            driver = new ChromeDriver(options);
            wait   = new WebDriverWait(driver, TimeSpan.FromSeconds(10));

            var allLogTypes = driver.Manage().Logs.AvailableLogTypes; //Теперь видно, что я могу посмотреть Performance логи
            //Performance логов очень много потому, что там можно увидеть информацию о загрузке всех ресурсов, которые
            //встречаются на этой странице(картинки, скрипты и т.д). Можно посмотреть сколько времени заняла загрузка,
            //сколько данных загрузилось, сколько времени ушло на отрисовку страницы и т.д.
            //Читать такие логи очень сложно, но есть люди, которые этим занимаются - измеряют и тестируют производительность страницы(скорость ее загрузки).
            //НО это НЕ ТЕСТИРОВАНИЕ ПРОИЗВОДИТЕЛЬНОСТИ(когда сильно нагружием сервер).
            //Здесь идет речь о другом тестировании производительности, о том, как быстро загружаются и отрисовываются страницы в браузере.
            //Для пользователя важно и то и то - чтобы сервер быстро присылал и чтобы все быстро отрисовывалось.
        }
Beispiel #2
0
        private static IWebDriver CreateChromDriver(string chromeDriverPath)
        {
            IWebDriver driver;
            var        arrayList = new ArrayList {
                "--disable-glsl-translator --start-maximized --automation-reinitialize-on-channel-error --bwsi --assert-test --test-type --disable-logging --disable-plugins --disable-translate --disable-web-security"
            };
            var desiredCapabilities = DesiredCapabilities.Chrome();
            var chromeOptions       = new ChromeOptions();

            chromeOptions.AddArguments("test-type");
            chromeOptions.AddArgument("--start-maximized");
            chromeOptions.AddArguments("disable-infobars");

            var perfLogPrefs = new ChromePerformanceLoggingPreferences();

            perfLogPrefs.AddTracingCategories(new string[] { "devtools.network" });

            chromeOptions.AddAdditionalCapability(CapabilityType.EnableProfiling, true, true);
            //chromeOptions.PerformanceLoggingPreferences = perfLogPrefs;
            chromeOptions.SetLoggingPreference("performance", LogLevel.All);
            chromeOptions.AddUserProfilePreference("intl.accept_languages", "en-AU");
            desiredCapabilities.SetCapability("download.prompt_for_download", false);
            //desiredCapabilities.SetCapability("download.default_directory", browserDownloadDir);
            desiredCapabilities.SetCapability("disable-extensions", true);
            desiredCapabilities.SetCapability("chrome.switches", arrayList);

            var baseExecutingAssemblyDir = Path.GetDirectoryName(new Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase).LocalPath);
            var commandTimeout           = new TimeSpan(0, 0, 60);

            driver = new ChromeDriver(Path.Combine(baseExecutingAssemblyDir ?? string.Empty, chromeDriverPath), chromeOptions, commandTimeout);

            return(driver);
        }
Beispiel #3
0
        private void Button1_Click(object sender, EventArgs e)
        {
            var chromeDriverService = ChromeDriverService.CreateDefaultService();

            chromeDriverService.HideCommandPromptWindow = true;
            ChromeOptions options = new ChromeOptions();

            var perfLogPrefs      = new ChromePerformanceLoggingPreferences();
            var tracingCategories = "toplevel,disabled-by-default-devtools.timeline.frame,blink.console,disabled-by-default-devtools.timeline,benchmark";

            perfLogPrefs.AddTracingCategories(new string[] { tracingCategories });
            options.PerformanceLoggingPreferences = perfLogPrefs;
            options.SetLoggingPreference("performance", LogLevel.All);
            chromeDriver = new ChromeDriver(chromeDriverService, options);
            chromeDriver.Navigate().GoToUrl("https://www.facebook.com/");
            chromeDriver.FindElementByClassName("inputtext").Click();
            //get bz file
            var    logs = chromeDriver.Manage().Logs.GetLog("performance");
            object s;

            File.WriteAllText("result/json.txt", "");

            foreach (var item in logs)
            {
                if (item.Message.ToString().Contains("https://www.facebook.com/ajax/bz") && item.Message.ToString().Contains("postData"))
                {
                    s = JsonConvert.SerializeObject(item);
                    File.AppendAllText("result/json.txt", s.ToString() + "\r\n\r\n");
                }
            }
            MessageBox.Show(File.ReadAllText("result/json.txt"));
        }
Beispiel #4
0
        private void SetBrowserLoggingCapabilities(ref ChromeOptions options)
        {
            var perfLogPrefs      = new ChromePerformanceLoggingPreferences();
            var tracingCategories = "toplevel,disabled-by-default-devtools.timeline.frame,blink.console,disabled-by-default-devtools.timeline,benchmark";

            perfLogPrefs.AddTracingCategories(new string[] { tracingCategories });
            options.PerformanceLoggingPreferences = perfLogPrefs;
            options.SetLoggingPreference("performance", LogLevel.All);
        }
Beispiel #5
0
        private void btnmoweb_Click(object sender, EventArgs e)
        {
            ChromePerformanceLoggingPreferences perfLogPrefs = new ChromePerformanceLoggingPreferences();

            perfLogPrefs.AddTracingCategories(new string[] { "devtools.timeline" });
            ChromeOptions options = new ChromeOptions();

            options.AddArguments("--disable-notifications");
            options.AddArgument("--window-size=1500,900");
            options.AddArgument("--disable-infobars");
            options.PerformanceLoggingPreferences = perfLogPrefs;
            options.SetLoggingPreference(LogType.Driver, LogLevel.All);
            options.SetLoggingPreference("performance", LogLevel.All);
            options.AddAdditionalCapability(CapabilityType.EnableProfiling, true, true);
            PropretiesCollection.driver = new ChromeDriver(options);
            PropretiesCollection.driver.Navigate().GoToUrl("https://thuthapdiachi.vnpost.vn/");
        }
Beispiel #6
0
        private void btnlaythongtinchatluong_Click(object sender, EventArgs e)
        {
            Thread chay = new Thread(() =>
            {
                hamxoafile(@"C:\TempExcel");
                #region     // lay thông tin phát
                ChromePerformanceLoggingPreferences perfLogPrefs = new ChromePerformanceLoggingPreferences();
                perfLogPrefs.AddTracingCategories(new string[] { "devtools.timeline" });
                ChromeOptions options = new ChromeOptions();
                var downloadDirectory = @"C:\TempExcel";
                options.AddUserProfilePreference("download.default_directory", downloadDirectory);
                options.AddUserProfilePreference("download.prompt_for_download", false);
                options.AddUserProfilePreference("disable-popup-blocking", "true");

                options.AddArguments("--disable-notifications");
                options.PerformanceLoggingPreferences = perfLogPrefs;
                options.SetLoggingPreference(LogType.Driver, LogLevel.All);
                options.SetLoggingPreference("performance", LogLevel.All);
                options.AddAdditionalCapability(CapabilityType.EnableProfiling, true, true);
                PropretiesCollection.driver = new ChromeDriver(options);
                PropretiesCollection.driver.Navigate().GoToUrl("https://chatluong.vnpost.vn");
                ChatLuong cl = new ChatLuong();
                cl.XuLy(txttaikhoanchatluong.Text, txtpasschatluong.Text, txtngaychatluong.Text, txtngaychatluong.Text, 1);
                //chạy xong tắt chome
                PropretiesCollection.driver.Close();

                #region         //xử lý luôn file excel down về lưu vào csdl
                string fileexcel   = @"C:\TempExcel\" + "Chat Luong cong doan phat theo buu cuc phat.xlsx";
                DuLieuExcel dExcel = new DuLieuExcel();
                DataTable DuLieu   = new DataTable();
                dExcel.TenFile     = fileexcel;
                DuLieu             = dExcel.Doc().Tables[0];
                if (DuLieu.Rows.Count > 0)
                {
                }
                hamxoafile(@"C:\TempExcel");
                #endregion

                #endregion
            }
                                     );

            chay.Start();
        }
Beispiel #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            ChromePerformanceLoggingPreferences perfLogPrefs = new ChromePerformanceLoggingPreferences();

            perfLogPrefs.AddTracingCategories(new string[] { "devtools.timeline" });
            ChromeOptions options = new ChromeOptions();

            options.AddArguments("--disable-notifications");
            options.AddArguments("--incognito");
            options.PerformanceLoggingPreferences = perfLogPrefs;
            options.SetLoggingPreference(LogType.Driver, LogLevel.All);
            options.SetLoggingPreference("performance", LogLevel.All);
            options.AddAdditionalCapability(CapabilityType.EnableProfiling, true, true);
            PropretiesCollection.driver = new ChromeDriver(options);
            PropretiesCollection.driver.Navigate().GoToUrl("http://facebook.com/");
            Test a = new Test();

            a.DangKy("tran", "Linh", "*****@*****.**", "*****@*****.**");
        }
        private static IWebDriver GetDriver(string browserType)
        {
            IWebDriver curDriver = null;

            switch (browserType)
            {
            case "chrome":
                DesiredCapabilities capabilites = DesiredCapabilities.Chrome();
                capabilites.SetCapability("navtiveEvents", true);
                ChromePerformanceLoggingPreferences logPrefs = new ChromePerformanceLoggingPreferences();
                logPrefs.AddTracingCategories(LogType.Profiler);
                ChromeOptions options = new ChromeOptions();
                options.SetLoggingPreference(LogType.Browser, LogLevel.Warning);
                curDriver = new ChromeDriver(options);
                Reporter.SetReporter();
                Reporter.StartTestReporting("Test Started");
                break;
            }
            return(curDriver);
        }
Beispiel #9
0
        private void btnganbuucucthugom_Click(object sender, EventArgs e)
        {
            Thread chay = new Thread(() =>
            {
                ChromePerformanceLoggingPreferences perfLogPrefs = new ChromePerformanceLoggingPreferences();
                perfLogPrefs.AddTracingCategories(new string[] { "devtools.timeline" });
                ChromeOptions options = new ChromeOptions();
                options.AddArguments("--disable-notifications");
                options.PerformanceLoggingPreferences = perfLogPrefs;
                options.SetLoggingPreference(LogType.Driver, LogLevel.All);
                options.SetLoggingPreference("performance", LogLevel.All);
                options.AddAdditionalCapability(CapabilityType.EnableProfiling, true, true);
                PropretiesCollection.driver = new ChromeDriver(options);
                PropretiesCollection.driver.Navigate().GoToUrl("https://pns.vnpost.vn/tin/thiet-lap-buu-cuc-thu-gom-tu-dong.html");
                PNS login = new PNS();
                login.login(txttaikhoanpns.Text, txtpasspns.Text);

                da_dmkhachhangmcs mcs = new da_dmkhachhangmcs();
                DataTable dt          = new DataTable();
                dt = mcs.DanhSachkhachhangmcs(Cl_KetNoi.hamketnoisqlhtkh2015());
                if (dt.Rows.Count > 0)
                {
                    foreach (DataRow r in dt.Rows)
                    {
                        string macrm     = r["MaCRM"].ToString();
                        string dienthoai = r["DienThoai"].ToString();
                        string trungtam  = r["IDCapTren"].ToString();
                        string mabuucuc  = r["MaBuuCuc"].ToString();
                        PNS them         = new PNS();
                        int kq           = them.GanTuDong(macrm, dienthoai, trungtam, mabuucuc);
                        if (kq == 1)
                        {
                            da_dmkhachhangmcs xacnhan = new da_dmkhachhangmcs();
                            xacnhan.DaTruyen(Cl_KetNoi.hamketnoisqlhtkh2015(), macrm, dienthoai);
                        }
                    }
                }
            });

            chay.Start();
        }
        protected virtual DriverOptions CreateChromeDriverOptions()
        {
            var options = new ChromeOptions();

            options.LeaveBrowserRunning = true;
            options.AddArgument("bwsi");
            options.AddArgument("ignore-certificate-errors");
            //options.AddArgument("disable-extensions");
            options.AddArgument("window-size=1920,1080");
            options.AddArgument("start-maximized");
            options.AddArgument("allow-insecure-localhost");
            options.AddArgument("no-sandbox");
            options.AddAdditionalCapability("useAutomationExtension", false);


            if (string.Equals(_configurationReader.GetConfigurationValue(Constants.Configuration.EnableDetailedLogging).ToLower(), Generic.TrueValue))
            {
                var perfLogPrefs = new ChromePerformanceLoggingPreferences();
                perfLogPrefs.AddTracingCategories("devtools.network");
                options.PerformanceLoggingPreferences = perfLogPrefs;
                options.AddAdditionalCapability(CapabilityType.EnableProfiling, true, true);
                options.SetLoggingPreference("performance", LogLevel.All);
            }

            if (string.Equals(_configurationReader.GetConfigurationValue(Constants.Configuration.HeadlessKey).ToLower(), Generic.TrueValue))
            {
                options.AddArguments("headless");
                options.AddArgument("verbose");
                options.AddArgument("disable-gpu");
                options.AddArgument("allow-running-insecure-content");
                options.AddAdditionalCapability(CapabilityType.AcceptSslCertificates, true, true);
                options.AddAdditionalCapability(CapabilityType.AcceptInsecureCertificates, true, true);

                /*options.AddArgument("disable-extensions");
                 * options.AddArgument("disable-gpu");
                 * options.AddArgument("disable-infobars");*/
            }

            return(options);
        }
Beispiel #11
0
        public void SomeTestMethod1InBrowserFactoryWithSettings()
        {
            string inputBrowser = "Chrome";

            switch (inputBrowser)
            {
            case "Chrome":
                //Deprecated. How will you merge cap and options and send to driver constructor.
                //DesiredCapabilities cap = new DesiredCapabilities();
                //cap.SetCapability(CapabilityType.AcceptInsecureCertificates,true);
                //cap.SetCapability(CapabilityType.AcceptSslCertificates,true);
                //cap.SetCapability(CapabilityType.HandlesAlerts,true);
                //cap.SetCapability(CapabilityType.IsJavaScriptEnabled,true);
                //cap.SetCapability(CapabilityType.UnexpectedAlertBehavior,true);
                //cap.SetCapability(CapabilityType.UnhandledPromptBehavior,true);

                ChromeOptions options = new ChromeOptions();
                options.AcceptInsecureCertificates = true;
                options.AddArguments("disable-infobars");
                options.AddArgument("ignore-certificate-errors");
                options.AddArgument("start-maximized");
                options.AddArgument("test-type");
                options.EnableMobileEmulation("Nexus 5");

                //var proxy = new Proxy();
                //proxy.Kind = ProxyKind.Manual;
                //proxy.IsAutoDetect = true;
                //proxy.HttpProxy = "";
                //proxy.SslProxy = "";
                //options.Proxy = proxy;

                //options.AddExtension(@"load - extension = c:\PathToFirstExtensionHere, c:\PathToSecondExtensionHere");

                bool?AcceptInsecureCertificates           = options.AcceptInsecureCertificates;
                ReadOnlyCollection <string> ArgumentsList = options.Arguments;
                string BinaryLocation  = options.BinaryLocation;
                string BrowserName     = options.BrowserName;
                string BrowserVersion  = options.BrowserVersion;
                string DebuggerAddress = options.DebuggerAddress;
                ReadOnlyCollection <string> ExtensionsList = options.Extensions;
                bool             LeaveBrowserRunning       = options.LeaveBrowserRunning;
                string           MinidumpPath     = options.MinidumpPath;
                PageLoadStrategy PageLoadStrategy = options.PageLoadStrategy;
                ChromePerformanceLoggingPreferences PerformanceLoggingPreferences = options.PerformanceLoggingPreferences;
                string PlatformName = options.PlatformName;
                Proxy  Proxy        = options.Proxy;
                UnhandledPromptBehavior UnhandledPromptBehavior = options.UnhandledPromptBehavior;
                bool UseSpecCompliantProtocol = options.UseSpecCompliantProtocol;

                Console.WriteLine($"  AcceptInsecureCertificates   : {AcceptInsecureCertificates}");
                foreach (string s in ArgumentsList)
                {
                    Console.WriteLine($"  ArgumentsList   : {s}");
                }

                Console.WriteLine($" BinaryLocation    : {BinaryLocation}");
                Console.WriteLine($" BrowserName    : {BrowserName}");
                Console.WriteLine($" BrowserVersion    : {BrowserVersion}");
                Console.WriteLine($" DebuggerAddress    : {DebuggerAddress}");
                foreach (string s in ExtensionsList)
                {
                    Console.WriteLine($"  ExtensionsList   : {s}");
                }

                Console.WriteLine($" LeaveBrowserRunning    : {LeaveBrowserRunning}");
                Console.WriteLine($" MinidumpPath    : {MinidumpPath}");
                Console.WriteLine($" PageLoadStrategy    : {PageLoadStrategy}");
                Console.WriteLine($" PerformanceLoggingPreferences    : {PerformanceLoggingPreferences}");
                Console.WriteLine($" PlatformName   : {PlatformName}");
                Console.WriteLine($" Proxy   : {Proxy}");
                Console.WriteLine($" UnhandledPromptBehavior    : {UnhandledPromptBehavior}");
                Console.WriteLine($" UseSpecCompliantProtocol   : {UseSpecCompliantProtocol}");

                //options.AddAdditionalCapability(CapabilityType.AcceptInsecureCertificates,true);
                //options.AddAdditionalCapability(CapabilityType.AcceptSslCertificates,true);
                //options.AddAdditionalCapability(CapabilityType.HandlesAlerts, true);
                //options.AddAdditionalCapability(CapabilityType.IsJavaScriptEnabled, true);
                //options.AddAdditionalCapability(CapabilityType.UnexpectedAlertBehavior,true);
                //options.AddAdditionalCapability(CapabilityType.UnhandledPromptBehavior, UnhandledPromptBehavior.Accept);
                //options.AddAdditionalCapability(CapabilityType.Platform,PlatformType.Windows);

                driver = new ChromeDriver(options);
                System.Environment.SetEnvironmentVariable("webdriver.chrome.driver", @"C:\Users\v-rusom\Documents\visual studio 2015\Projects\SomeThingInAutomation\SomeTestingInAutomation\bin\Debug\chromedriver.exe");
                break;

            case "IE":

                //DesiredCapabilities caps = DesiredCapabilities.InternetExplorer();
                //caps.SetCapability("ignoreZoomSetting",true);

                InternetExplorerOptions ieoptions = new InternetExplorerOptions();
                //ieoptions.ForceCreateProcessApi = true;
                ieoptions.IgnoreZoomLevel = true;
                ieoptions.IntroduceInstabilityByIgnoringProtectedModeSettings = true;
                //ieoptions.AcceptInsecureCertificates = true;
                ieoptions.BrowserCommandLineArguments = "-private";

                //var ieproxy = new Proxy();
                //ieproxy.Kind = ProxyKind.Manual;
                //ieproxy.IsAutoDetect = false;
                //ieproxy.HttpProxy = "127.0.0.1";
                //ieproxy.SslProxy = "127.0.0.1";
                //ieoptions.Proxy = ieproxy;

                driver = new InternetExplorerDriver(ieoptions);

                System.Environment.SetEnvironmentVariable("webdriver.ie.driver", @"C:\Users\v-rusom\Documents\visual studio 2015\Projects\SomeThingInAutomation\SomeTestingInAutomation\bin\Debug\IEDriverServer.exe");
                break;

            default:
                Console.WriteLine("Plese enter correct browser here");
                break;
            }
            driver.Manage().Window.Maximize();
            driver.Manage().Cookies.DeleteAllCookies();
            driver.Url = "http://executeautomation.com/demosite/index.html?UserName=fdghhf&Password=dfgdfg&Login=Login";

            IJavaScriptExecutor jse = (IJavaScriptExecutor)driver;

            jse.ExecuteScript("document.getElementById('TitleId').style.borderColor='Red';");
            Thread.Sleep(20);
            jse.ExecuteScript("document.getElementById('TitleId').selectedIndex=1;");
            Thread.Sleep(20);
            jse.ExecuteScript("document.getElementById('TitleId').style.borderColor='Green';");
            Thread.Sleep(20);

            jse.ExecuteScript("document.getElementById('Initial').style.borderColor='Red';" +
                              "document.getElementById('Initial').value='Somala';" +
                              "document.getElementById('Initial').style.borderColor='Green';");
            Thread.Sleep(20);

            jse.ExecuteScript("document.getElementById('FirstName').style.borderColor='Red';");
            Thread.Sleep(20);
            jse.ExecuteScript("document.getElementById('FirstName').value='Rupesh';");
            Thread.Sleep(20);
            jse.ExecuteScript("document.getElementById('FirstName').style.borderColor='Green';");
            Thread.Sleep(20);

            jse.ExecuteScript("document.getElementById('MiddleName').style.borderColor='Red';");
            Thread.Sleep(20);
            jse.ExecuteScript("document.getElementById('MiddleName').value='Kumar';");
            Thread.Sleep(20);
            jse.ExecuteScript("document.getElementById('MiddleName').style.borderColor='Green';");
            Thread.Sleep(20);


            Assert.AreEqual("Execute Automation", driver.Title);


            driver.Close();
            driver.Quit();
        }
Beispiel #12
0
        private void MapPerformanceLoggingPreferences(DriverPerformanceLoggingPreferencesJsonSection section, ChromePerformanceLoggingPreferences preferences)
        {
            ObjectMapper.Map(section.ExtraPropertiesMap, preferences);

            if (section.TracingCategories?.Any() ?? false)
            {
                preferences.AddTracingCategories(section.TracingCategories);
            }
        }
Beispiel #13
0
        private void btnchaylaithongtinphat_Click(object sender, EventArgs e)
        {
            Thread chay = new Thread(() =>
            {
                txtlog.Text               = "";
                da_dmbclay bc             = new da_dmbclay();
                DataTable tablebuucuc     = new DataTable();
                tablebuucuc               = bc.DanhSachBuuCucKhongsoLieu(Cl_KetNoi.hamketnoisql(), txttungay.Text);
                DataTable tbc             = (DataTable)listbuucuc.DataSource;
                lblbuucuckhongsolieu.Text = "Số lượng bưu cục không số liệu :" + tablebuucuc.Rows.Count.ToString() + "/" + tbc.Rows.Count.ToString();

                if (tablebuucuc.Rows.Count > 0)
                {
                    #region // lay thông tin phát
                    ChromePerformanceLoggingPreferences perfLogPrefs = new ChromePerformanceLoggingPreferences();
                    perfLogPrefs.AddTracingCategories(new string[] { "devtools.timeline" });
                    ChromeOptions options = new ChromeOptions();
                    options.AddArguments("--disable-notifications");
                    options.PerformanceLoggingPreferences = perfLogPrefs;
                    options.SetLoggingPreference(LogType.Driver, LogLevel.All);
                    options.SetLoggingPreference("performance", LogLevel.All);
                    options.AddAdditionalCapability(CapabilityType.EnableProfiling, true, true);
                    PropretiesCollection.driver = new ChromeDriver(options);
                    PropretiesCollection.driver.Navigate().GoToUrl("http://thongtinphat.vnpost.vn/Security/SignIn");
                    // PropretiesCollection.driver.Manage().Window.Size = new Size(480, 720);
                    ThongTinPhat t = new ThongTinPhat();
                    t.login(txttaikhoan.Text, txtmatkhau.Text, txttungay.Text.Trim(), txttungay.Text.Trim());
                    txtlog.Text  = txtlog.Text + "\r\n" + "Login thành công bắt đầu quét dữ liệu" + "-->" + DateTime.Now.ToString();
                    lblxuly.Text = "0";
                    int i        = 1;
                    foreach (DataRow r in tablebuucuc.Rows)
                    {
                        string mabuucuc  = r["mabuucuc"].ToString();
                        string tenbuucuc = r["buucuc"].ToString();
                        txtlog.Text      = txtlog.Text + "\r\n" + "Bắt đầu đọc dữ liệu bưu cục " + mabuucuc + "-" + tenbuucuc + "-->" + DateTime.Now.ToString();;
                        DataTable dt     = new DataTable();
                        dt          = t.ThongTin(mabuucuc, int.Parse(txttimernghi.Value.ToString()));
                        txtlog.Text = txtlog.Text + "\r\n" + "Bưu cục " + tenbuucuc + " Có số lượng bản ghi là:" + dt.Rows.Count.ToString() + "-->" + DateTime.Now.ToString();
                        if (dt.Rows.Count > 0)
                        {
                            #region // ghi dữ liệu vào csdl SMP
                            da_smp_mau ghi = new da_smp_mau();
                            ghi.CapNhat(Cl_KetNoi.hamketnoisql(), dt, txttungay.Text, mabuucuc);
                            txtlog.Text = txtlog.Text + "\r\n" + "Ghi thành công dữ liệu cho bưu cục :" + tenbuucuc + "-->" + DateTime.Now.ToString();

                            #endregion
                        }
                        lblxuly.Text = "Xử lý :" + i.ToString() + "/" + tablebuucuc.Rows.Count.ToString();
                        i++;
                        ScrollToBottom(txtlog);
                    }
                    txtlog.Text = txtlog.Text + "\r\n" + "Đã Xong!" + "-->" + DateTime.Now.ToString();

                    da_smp_mau dlngay     = new da_smp_mau();
                    DataTable tableBC     = new DataTable();
                    tableBC               = dlngay.DanhSachSoLieu(Cl_KetNoi.hamketnoisql(), txttungay.Text);
                    listbuucuc.DataSource = tableBC;
                    //chạy xong tắt chome
                    PropretiesCollection.driver.Close();
                    #endregion
                }
                else
                {
                    MessageBox.Show("Lỗi không có danh sách bưu cục cần lấy dữ liệu");
                    return;
                }
            }
                                     );

            chay.Start();
        }