public override void Execute(object sender, EventArgs e)
        {
            var dte = (EnvDTE.DTE)_visualStudioPackageProvider.Package.DTE; //GetService(typeof(EnvDTE.DTE));

            HashSet <int> roots = new HashSet <int>();

            foreach (EnvDTE90.Process3 p in dte.Debugger.DebuggedProcesses)
            {
                if (p.IsBeingDebugged && ChromeUtility.IsChromeProcess(p.Name))
                {
                    roots.Add(p.ProcessID);
                }
            }

            foreach (EnvDTE90.Process3 p in dte.Debugger.LocalProcesses)
            {
                if (p.IsBeingDebugged || !ChromeUtility.IsChromeProcess(p.Name))
                {
                    continue;
                }

                NtProcess process = new NtProcess(p.ProcessID);
                if (!roots.Contains(process.ParentProcessId))
                {
                    continue;
                }

                p.Attach();
            }
        }
Ejemplo n.º 2
0
        public override void Execute(object sender, EventArgs e)
        {
            var dte = (EnvDTE.DTE)_visualStudioPackageProvider.Package.DTE; //GetService(typeof(EnvDTE.DTE));

            foreach (EnvDTE90.Process3 p in dte.Debugger.LocalProcesses)
            {
                if (!p.IsBeingDebugged && ChromeUtility.IsChromeProcess(p.Name))
                {
                    p.Attach();
                }
            }
        }
        public static void VscxOnRuntimeInstanceLoad(this DkmRuntimeInstance runtime)
        {
            if (runtime.TagValue != DkmRuntimeInstance.Tag.NativeRuntimeInstance)
            {
                return;
            }

            DkmNativeRuntimeInstance nativeRuntime = (DkmNativeRuntimeInstance)runtime;
            bool isChrome      = false;
            bool isTestProcess = false;

            // Check if the process is a chrome executable, and if so, attach a CallstackFilter to the DkmProcess.
            if (ChromeUtility.IsChromeProcess(nativeRuntime.Process.Path))
            {
                isChrome = true;
            }
#if DEBUG
            string fileName = Path.GetFileName(nativeRuntime.Process.Path);
            if (fileName.Equals("vistest.exe", StringComparison.CurrentCultureIgnoreCase))
            {
                isTestProcess = true;
            }
#endif

            if (isTestProcess || isChrome)
            {
                DkmProcess process = nativeRuntime.Process;

                DebugProcessOptions         options         = DebugProcessOptions.Create(process.DebugLaunchSettings.OptionsString);
                ProcessDebugOptionsDataItem optionsDataItem = new ProcessDebugOptionsDataItem(options);
                process.SetDataItem(DkmDataCreationDisposition.CreateAlways, optionsDataItem);

                if (isTestProcess || ShouldEnableChildDebugging(nativeRuntime.Process, options))
                {
                    process.SetDataItem(DkmDataCreationDisposition.CreateAlways, new RuntimeBreakpointHandler());
                    process.SetDataItem(DkmDataCreationDisposition.CreateAlways, new AutoAttachToChildHandler());
                }
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        public void Test(UI202ViewModel model)
        {
            SeleniumModel excelModel = SeleniumUtiltity.ReadSeleniumFile(@"E:\GitHub\YsProject\YsProject\Excels\Selenium.xlsx");

            using (ChromeUtility driver = new ChromeUtility("https://*****:*****@"D:\Work\GitHub\a.png", ScreenshotImageFormat.Png, true);
            //string url = driver.Url;
            //string title = driver.Title;
            //string handle = driver.CurrentWindowHandle;  -- ???
            //driver.Navigate().Back();
            //driver.Navigate().Forward();
            //driver.Navigate().Refresh();
            //System.Drawing.Size s = driver.Manage().Window.Size;
            //driver.Manage().Window.Size = new System.Drawing.Size(1024, 768);
            //System.Drawing.Point point = driver.Manage().Window.Position;
            //driver.Manage().Window.Position = new System.Drawing.Point(0, 0);
            //driver.Manage().Window.Maximize();
            //driver.Manage().Window.Minimize();


            //ChromeOptions options = new ChromeOptions();
            //options.AddExcludedArgument("enable-automation");
            //options.AddArguments("--test-type", "--ignore-certificate-errors");
            //options.AddAdditionalCapability("useAutomationExtension", false);

            //IWebDriver driver = new ChromeDriver(options);
            //driver.Manage().Window.Maximize();

            //List<string> pages = new List<string>();
            //try
            //{
            //    WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30))
            //    {
            //        PollingInterval = TimeSpan.FromSeconds(3),
            //    };
            //    wait.IgnoreExceptionTypes(typeof(NoSuchElementException));

            //    string url = "https://172.21.4.200/log_in";
            //    driver.Navigate().GoToUrl(url);
            //    IWebElement e1 = wait.Until(e => e.FindElement(By.Id("name")));
            //    e1.SendKeys("tomohiro.matsumura");

            //    pages.Add(driver.CurrentWindowHandle);

            //    IWebElement e2 = driver.FindElement(By.ClassName("functionButton"));
            //    e2.Click();

            //    IWebElement e3 = wait.Until(e => e.FindElement(By.ClassName("mainmenu")));
            //    e3.Click();

            //    IWebElement e4 = wait.Until(e => e.FindElement(By.ClassName("linkButton")));
            //    e4.Click();

            //    IWebElement e5 = wait.Until(e => e.FindElement(By.Name("limit_level")));

            //    SelectElement select = new SelectElement(e5);
            //    while (select == null || select.AllSelectedOptions.Count == 0)
            //    {
            //        Thread.Sleep(100);
            //        e5 = driver.FindElement(By.Name("limit_level"));
            //        select = new SelectElement(e5);
            //    }
            //    select.SelectByText("担当外秘");
            //    //select.SelectByIndex(2);

            //    IWebElement e6 = driver.FindElement(By.CssSelector("input.border.border-glay.form-control-sm.form-control.datePickerCustom"));
            //    e6.SendKeys("2019/01/03");
        }