Ejemplo n.º 1
0
        public void CrossBrowserDemo()
        {
            IWebDriver driver;

            //driver = new ChromeDriver();
            //driver = new FirefoxDriver();
            // driver = new InternetExplorerDriver();
            // driver = new EdgeDriver(); // legacy

            //https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/ for edge
            //https://docs.microsoft.com/en-us/microsoft-edge/webdriver-chromium // new edge chromium
            // Make sure you download the chromium msedgedriver.exe from the above link for new chromium edge
            // for legacy follow the cmd prompt instruction to enble legacy webdriver as mentioned in above link.

            var options = new Microsoft.Edge.SeleniumTools.EdgeOptions();

            options.UseChromium    = true;
            options.BinaryLocation = @"C:\Program Files (x86)\Microsoft\Edge Beta\Application\msedge.exe";


            driver = new Microsoft.Edge.SeleniumTools.EdgeDriver(options);



            driver.Url = "https://abrakh.com/";
            driver.Manage().Window.Maximize();
            Console.WriteLine(driver.Title);
        }
Ejemplo n.º 2
0
        private void button2_Click(object sender, EventArgs e)
        {
            SoundPlayer SP = new SoundPlayer(@Application.StartupPath + @"\Data\Music\Sou\Nguoi than.wav");

            SP.Play();



            var driverservice = Microsoft.Edge.SeleniumTools.EdgeDriverService.CreateChromiumService();

            driverservice.HideCommandPromptWindow = true;

            var options = new Microsoft.Edge.SeleniumTools.EdgeOptions();

            options.UseChromium    = true;
            options.BinaryLocation = @"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe";

            var driver = new Microsoft.Edge.SeleniumTools.EdgeDriver(driverservice, options);

            driver.Url = "https://www.messenger.com/login/";
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);
            IWebElement query = driver.FindElement(By.CssSelector("#email"));

            query.SendKeys("ldh2210");
            query = driver.FindElement(By.CssSelector("#pass"));
            query.SendKeys("lehoang2210kt");
            query = driver.FindElement(By.CssSelector("#loginbutton"));
            query.Click();
            driver.Navigate().GoToUrl("https://www.messenger.com/t/100012544930422");

            query = driver.FindElement(By.XPath(".//*[@role = 'presentation']"));
            query.Click();

            //driver.Quit();
        }