示例#1
0
        public void GoogleSearch_test()
        {
            try
            {
                //initialize selenium browser
                SeleniumBrowser browser = new SeleniumBrowser(driver);

                //open google
                browser.GoToUrl("https://www.google.com/");

                //perform search
                driver.FindElementById("lst-ib").SendKeys("Testing with Selenium");
                driver.Keyboard.SendKeys(Keys.Enter);
                browser.WaitForLoad();

                //open selenium link
                driver.FindElementByXPath("//a[@href='https://www.seleniumhq.org/']").Click();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                SeleniumServer.Cleanup(driver);
            }
        }