当前位置: 首页>>代码示例>>C#>>正文


C# IE.ShowWindow方法代码示例

本文整理汇总了C#中WatiN.Core.IE.ShowWindow方法的典型用法代码示例。如果您正苦于以下问题:C# IE.ShowWindow方法的具体用法?C# IE.ShowWindow怎么用?C# IE.ShowWindow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WatiN.Core.IE的用法示例。


在下文中一共展示了IE.ShowWindow方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LoginUser

        /// <summary>
        /// Logins the user.
        /// </summary>
        /// <param name="browser">The <paramref name="browser"/> instance.</param>
        /// <param name="userName">Name of the user.</param>
        /// <param name="userPassword">The user password.</param>
        /// <returns>If User login was successfully or not</returns>
        public static bool LoginUser(IE browser, string userName, string userPassword)
        {
            // Login User
            browser.GoTo("{0}yaf_login.aspx".FormatWith(TestConfig.TestForumUrl));

            // Check If User is already Logged In
            if (browser.Link(Find.ById(new Regex("_LogOutButton"))).Exists)
            {
                browser.Link(Find.ById("forum_ctl01_LogOutButton")).Click();

                browser.Button(Find.ById("forum_ctl02_OkButton")).Click();
            }

            browser.GoTo("{0}yaf_login.aspx".FormatWith(TestConfig.TestForumUrl));

            browser.ShowWindow(NativeMethods.WindowShowStyle.Maximize);

            browser.TextField(Find.ById(new Regex("Login1_UserName"))).TypeText(userName);
            browser.TextField(Find.ById(new Regex("Login1_Password"))).TypeText(userPassword);

            browser.Button(Find.ById(new Regex("LoginButton"))).ClickNoWait();

            browser.GoTo(TestConfig.TestForumUrl);

            return browser.Link(Find.ById(new Regex("LogOutButton"))).Exists;
        }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:33,代码来源:TestHelper.cs

示例2: FetchEvents

        /// <summary>
        /// Screen Scrape Events
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        static List<EventDetail> FetchEvents(string query)
        {
            var eventDetails = new List<EventDetail>();
            using (var _browser = new IE("http://www.gettyimages.com", false))
            {
                _browser.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.Hide);
                _browser.TextField(Find.ById("txtPhrase")).Clear();
                _browser.TextField(Find.ById("txtPhrase")).TypeText(query);
                var editorialChkfield = _browser.CheckBox(Find.ById("cbxEditorial"));

                if (!editorialChkfield.Checked)
                    editorialChkfield.Click();

                _browser.Button(Find.ById("btnSearch")).Click();

                if (_browser.Link(Find.ById("ctl00_ctl00_ctl12_gcc_mc_re_flEvent_lnkSeeMore")).Exists)
                {
                    _browser.Link(Find.ById("ctl00_ctl00_ctl12_gcc_mc_re_flEvent_lnkSeeMore")).Click();
                    _browser.Div(Find.ById("ctl00_ctl00_ctl12_gcc_mc_re_flEvent_refinementContent")).WaitUntilExists();

                    var filterContentDiv = _browser.Div(Find.ById("ctl00_ctl00_ctl12_gcc_mc_re_flEvent_refinementContent"));

                    foreach (var link in filterContentDiv.Links.Filter(Find.ByClass("refineItem")))
                    {
                        var splitList = link.OuterHtml.Split('\'');

                        if (splitList.Length > 5)
                            eventDetails.Add(new EventDetail() { EventId = int.Parse(splitList[1]), EventName = splitList[5].Trim() });
                    }
                }
            }

            return eventDetails;
        }
开发者ID:karthik20522,项目名称:EventViewer,代码行数:39,代码来源:Program.cs

示例3: SetUp

 public void SetUp()
 {
     Settings.WaitForCompleteTimeOut = 10;
     Settings.WaitUntilExistsTimeOut = 10;
     ie = new IE();
     ie.GoTo(url + "ProspectorPlus/VendorLogin.aspx");
     ie.ShowWindow(NativeMethods.WindowShowStyle.Maximize);
 }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:8,代码来源:TestBase.cs

示例4: openThread_Click

 private void openThread_Click(object sender, EventArgs e)
 {
     var browser = new IE("forums.wynncraft.com/threads/invasion-tracker.28/page-" + a.ToString());
     browser.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.Maximize);
     string post = "There will be a swarm on Server " + server.ToString() + " in " + city.ToString() + ". ";
     if (mins != 0) { post += "It will be in " + mins.ToString() + " minutes time.";  }
     else { post += "I am unsure how long it is until it starts."; }
     Clipboard.SetText(post);
 }
开发者ID:Wynncraft,项目名称:WynnIR,代码行数:9,代码来源:Form1.cs

示例5: RegisterStandardTestUser

        /// <summary>
        /// Registers the standard test user.
        /// </summary>
        /// <param name="browser">The <paramref name="browser"/> instance.</param>
        /// <param name="userName">Name of the user.</param>
        /// <param name="password">The password.</param>
        /// <returns>
        /// If User was Registered or not
        /// </returns>
        public static bool RegisterStandardTestUser(IE browser, string userName, string password)
        {
            browser.GoTo("{0}yaf_register.aspx".FormatWith(TestConfig.TestForumUrl));

            var email = "{0}@test.com".FormatWith(userName.ToLower());

            browser.ShowWindow(NativeMethods.WindowShowStyle.Maximize);

            // Check if Registrations are Disabled
            if (browser.ContainsText("You tried to enter an area where you didn't have access"))
            {
                return false;
            }

            // Accept the Rules
            if (browser.ContainsText("Forum Rules"))
            {
                browser.Button(Find.ById("forum_ctl04_Login1_LoginButton")).Click();
                browser.Refresh();
            }

            if (browser.ContainsText("Security Image"))
            {
                return false;
            }

            // Fill the Register Page
            browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_UserName"))).TypeText(
                userName);

            if (browser.ContainsText("Display Name"))
            {
                browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_DisplayName"))).TypeText(userName);
            }

            browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_Password"))).TypeText(password);
            browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_ConfirmPassword"))).TypeText(password);
            browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_Email"))).TypeText(email);
            browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_Question"))).TypeText(password);
            browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_Answer"))).TypeText(password);

            ////browser.TextField(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_tbCaptcha"))).TypeText(captcha);

            // Create User
            browser.Button(Find.ById(new Regex("CreateUserWizard1_CreateUserStepContainer_StepNextButton"))).Click();

            if (!browser.ContainsText("Forum Preferences"))
            {
                return false;
            }

            browser.Button(Find.ById(new Regex("ProfileNextButton"))).Click();

            return browser.Link(Find.ById(new Regex("_LogOutButton"))).Exists;
        }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:64,代码来源:TestHelper.cs

示例6: NavigateToHomePage

        public static void NavigateToHomePage(ref IE ieBrowser)
        {
            if (ieBrowser == null)
            {
                ieBrowser = new IE();
                ieBrowser.ShowWindow(NativeMethods.WindowShowStyle.Maximize);
            }

            ieBrowser.GoTo(ConfigurationReader.getHomePageUrl() + "Default.aspx");
            ieBrowser.WaitForComplete();
        }
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:11,代码来源:Utilities.cs

示例7: QUnitParser

 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="maxWaitInMs">The maximum number of milliseconds before the tests should timeout after page load; -1 for infinity, 0 to not support asynchronous tests</param>
 public QUnitParser(int maxWaitInMs)
 {
     _maxWaitInMs = maxWaitInMs < 0 ? Int32.MaxValue : maxWaitInMs;
     _ie = new IE();
     if (NQUnit.HideBrowserWindow)
     {
         _ie.ShowWindow(NativeMethods.WindowShowStyle.Hide);
     }
     if (NQUnit.ClearCacheBeforeRunningTests)
     {
         _ie.ClearCache();
     }
 }
开发者ID:mattdotmatt,项目名称:NQUnit,代码行数:17,代码来源:QUnitParser.cs

示例8: InteractingWithElement

        public void InteractingWithElement()
        {
            using (var browser =
                new IE("http://localhost:62727/Pages/ApplyForCreditCard.aspx"))
            {
                browser.AutoClose = false;
                browser.ShowWindow(NativeMethods.WindowShowStyle.Minimize);
                browser.ShowWindow(NativeMethods.WindowShowStyle.Maximize);

            TextField applicantName = browser.TextField(Find.ById("Name"));
            applicantName.TypeText("Jason Roberts");

            Link helpHyperlink = browser.Link(Find.ById("HelpLink"));
            helpHyperlink.Click();

            SelectList title = browser.SelectList(Find.ById("Title"));
            title.Select("Prof");
            title.SelectByValue("4");

            Button applyButton = browser.Button(Find.ById("ApplyNow"));
            applyButton.Click();

            }
        }
开发者ID:stephenosrajan,项目名称:PSTestingEndToEnd,代码行数:24,代码来源:DemoCodeForSlides.cs

示例9: OpenIEInstance

        /// <summary>
        /// Opens a new IE instance with the given settings in front of other windows that are currently open.
        /// </summary>
        /// <param name="targetURL">The URL that the IE instance should browse to.</param>
        /// <param name="silentMode">If true the test will be run without displaying any IE instance or steps.</param>
        /// <param name="timeOut">The default time out to use when calling IE.AttachToIE(findby).</param>
        /// <param name="autoCloseIE">If true when a reference to the IE instance is destroyed the actual window will close.</param>
        /// <param name="movePointer">It true the mouse pointer will move to the top left corner of the screen when a new IE instance is created.</param>
        /// <returns>The new IE instance.</returns>
        public static IE OpenIEInstance(string targetURL, bool silentMode, int timeOut, bool autoCloseIE, bool movePointer)
        {
            Settings.MakeNewIeInstanceVisible = !silentMode;
            Settings.WaitForCompleteTimeOut = timeOut;
            Settings.WaitUntilExistsTimeOut = timeOut;
            Settings.AttachToBrowserTimeOut = timeOut;
            Settings.AutoMoveMousePointerToTopLeft = movePointer;

            IE ieInstance = new IE { AutoClose = autoCloseIE };
            if(!silentMode) ieInstance.ShowWindow(NativeMethods.WindowShowStyle.ShowMaximized);
            ieInstance.BringToFront();
            ieInstance.GoTo(targetURL);

            return ieInstance;
        }
开发者ID:biganth,项目名称:Curt,代码行数:24,代码来源:WatiNUtil.cs

示例10: SetUp

        public void SetUp()
        {
            Settings.WaitForCompleteTimeOut = 80;
            Settings.WaitUntilExistsTimeOut = 80;

            platform = (Platform)Enum.Parse(typeof(Platform), System.Configuration.ConfigurationManager.AppSettings["Platform"]);
            targetHost = System.Configuration.ConfigurationManager.AppSettings["TargetHost"];

            switch (platform)
            {
                case Platform.IE:

                    browser = new IE();
                    browser.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.Maximize);
                    break;
                case Platform.FF:
                    browser = new FireFox();
                    browser.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.Maximize);
                    break;

            }
            browser.GoTo(targetHost);
        }
开发者ID:nirvana-info,项目名称:old_bak,代码行数:23,代码来源:TestBase.cs

示例11: WatinDriver

 public WatinDriver(IE ie, string baseurl)
 {
     _baseurl = baseurl;
     IE = ie;
     IE.ShowWindow(NativeMethods.WindowShowStyle.Maximize);
 }
开发者ID:snahider,项目名称:Presentations,代码行数:6,代码来源:WatinDriver.cs

示例12: GetInternetExplorer

        public static IE GetInternetExplorer()
        {
            if (_browser == null)
            {
                lock (LOCK_ROOT)
                {
                    if (_browser == null)
                    {
                        IE.Settings.AutoMoveMousePointerToTopLeft = false;

                        _browser = (IE) BrowserFactory.Create(BrowserType.InternetExplorer);
                        _browser.ShowWindow(NativeMethods.WindowShowStyle.Hide);
                    }
                }
            }

            return _browser;
        }
开发者ID:adymitruk,项目名称:storyteller,代码行数:18,代码来源:JavaScriptTester.cs

示例13: BeforeTest

 public void BeforeTest()
 {
     Log = new TestContextLog(TestContext);
     _ie = new IE();
     _ie.ShowWindow(NativeMethods.WindowShowStyle.Hide);
 }
开发者ID:vc3,项目名称:ExoWeb,代码行数:6,代码来源:BaseQUnitTests.cs

示例14: WebApplicationScraping

        public void WebApplicationScraping()
        {
            try
            {
                // Reads the path of the web application
                string webSitePath = Convert.ToString(ConfigurationManager.AppSettings["WebApplicationPath"]);
                string filePhysicalPath = Convert.ToString(ConfigurationManager.AppSettings["ScraperEnginePhysicalLocation"]);

                StreamWriter file = new StreamWriter(filePhysicalPath + "Output.txt");

                if (webSitePath != null && webSitePath != string.Empty)
                {
                    // Create an instance of IE browser
                    IE ieInstance = new IE(webSitePath);

                    // This will opens IE browser in maximized mode
                    ieInstance.ShowWindow(WatiN.Core.Native.Windows.NativeMethods.WindowShowStyle.ShowMaximized);

                    // Watin window will not visible to the end user when web scraping is done
                    //ieInstance.Visible = false;

                    // This will wait for the browser to complete loading of the page
                    ieInstance.WaitForComplete();

                    // This will store page source in categoryPageSource variable
                    string categoryPageSource = ieInstance.Html;

                    // Regular expression pattern to fetch list of categories categories

                    Regex categoryMatches = new Regex(_categoryRegEx, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace | RegexOptions.CultureInvariant);

                    // Fetches all the categories based upon category regex from category listing page
                    MatchCollection categoryMatchCollection = categoryMatches.Matches(categoryPageSource);

                    // Navigate to each categories and fetch page URL and navigate to the item listing page for each categories
                    foreach (Match categoryMatch in categoryMatchCollection)
                    {
                        GroupCollection categoryGroup = categoryMatch.Groups;

                        // URL of the item listing page
                        string itemListingURL = Convert.ToString(categoryGroup["href"].Value);

                        // Partial web path where demonstration web site is deployed.
                        // Note: This path needs to be modified in App.Config file accordingly.
                        string webSiteHostedLocation = webSitePath.Remove(webSitePath.LastIndexOf("/"));

                        // Creates path of the category listing page.
                        string itemListingpath = webSiteHostedLocation + "/" + itemListingURL;

                        // Navigate to the item listing page
                        ieInstance.GoTo(itemListingpath);

                        ieInstance.WaitForComplete();

                        // HTML source of given generated web page
                        string itemListingPageSource = ieInstance.Html;

                        // Match for the paging Event
                        Regex pagingMatches = new Regex(_pagingRegEx, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace | RegexOptions.CultureInvariant | RegexOptions.Multiline);

                        // Find Matches.
                        MatchCollection pagingMatchCollection = pagingMatches.Matches(itemListingPageSource);

                        foreach (Match pageMatch in pagingMatchCollection)
                        {
                            GroupCollection pagingGroup = pageMatch.Groups;

                            if (pagingGroup[_pageNumber].Value != "1")
                            {
                                // Fetches the page number of the current page.
                                string linkText = Convert.ToString(pagingGroup[_pageNumber].Value);

                                // Performs click event on the given link. For e.g if linkText contains "2" as a value then 
                                //Watin will perform click event on this second link.
                                ieInstance.Link(Find.ByText(linkText)).Click();

                                // Wait for the operation to complete
                                ieInstance.WaitForComplete();

                                // Store the result of the page in itemListingPageSource variable
                                itemListingPageSource = ieInstance.Html;
                            }

                            Regex itemMatches = new Regex(_itemRegEx, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace | RegexOptions.CultureInvariant);

                            // Fetches all the items based upon item regex from the item listing page
                            MatchCollection itemMatchCollection = itemMatches.Matches(itemListingPageSource);

                            // Navigate to each item and fetch ProductID, ProductName and ProductPrice and store the result in text file
                            foreach (Match itemMatch in itemMatchCollection)
                            {
                                GroupCollection itemGroups = itemMatch.Groups;

                                // Fetch productId from the given item group
                                string productID = Convert.ToString(itemGroups[_productID].Value);

                                // Fetch productName from the given item Group
                                string productName = Convert.ToString(itemGroups[_productName].Value);

                                // Fetch product price from the given product price
//.........这里部分代码省略.........
开发者ID:vearvindkumar,项目名称:Scrapper,代码行数:101,代码来源:WebScraping.cs

示例15: SetupWebsite

        /// <summary>
        /// Setups the Test website.
        /// </summary>
        private void SetupWebsite()
        {
            IEInstance = new IE();

            IEInstance.GoTo("{0}install/default.aspx".FormatWith(TestConfig.TestForumUrl));

            IEInstance.ShowWindow(NativeMethods.WindowShowStyle.Maximize);

            IEInstance.WaitForComplete(5000);

            // Enter Config Password
            IEInstance.TextField(Find.ById("InstallWizard_txtEnteredPassword")).TypeText(TestConfig.ConfigPassword);
            IEInstance.Button(Find.ById("InstallWizard_StepNavigationTemplateContainerID_StepNextButton")).Click();

            IEInstance.Button(Find.ById("InstallWizard_StepNavigationTemplateContainerID_StepPreviousButton")).Click();

            IEInstance.RadioButton(Find.ById("InstallWizard_rblYAFDatabase_1")).Click();

            // Enter YAF Database Connection
            IEInstance.TextField(Find.ById("InstallWizard_Parameter1_Value")).TypeText(TestConfig.DatabaseServer);

            IEInstance.TextField(Find.ById("InstallWizard_Parameter2_Value")).TypeText(TestConfig.TestDatabase);

            // Test Database Conncection
            IEInstance.Button(Find.ById("InstallWizard_btnTestDBConnection")).Click();

            Assert.IsTrue(IEInstance.ContainsText("Connection Succeeded"), "Database Connection Is Wrong");

            IEInstance.Button(Find.ById("InstallWizard_StepNavigationTemplateContainerID_StepNextButton")).Click();

            // Test Mail Setup
            IEInstance.TextField(Find.ById("InstallWizard_txtTestFromEmail")).TypeText(TestConfig.TestForumMail);

            IEInstance.TextField(Find.ById("InstallWizard_txtTestToEmail")).TypeText("[email protected]");

            IEInstance.Button(Find.ById("InstallWizard_btnTestSmtp")).Click();

            Assert.IsTrue(
                IEInstance.ContainsText("Mail Sent. Verify it's received at your entered email address."),
                "Mail Send Failed");

            if (TestConfig.UseTestMailServer)
            {
                SmtpMessage mail = SmtpServer.ReceivedEmail[0];

                Assert.AreEqual("[email protected]", mail.ToAddresses[0].ToString(), "Receiver does not match");
                Assert.IsTrue(mail.FromAddress.ToString().Contains(TestConfig.TestForumMail), "Sender does not match");
                Assert.AreEqual(
                    "Test Email From Yet Another Forum.NET", mail.Headers["Subject"], "Subject does not match");

                Assert.AreEqual(
                    "The email sending appears to be working from your YAF installation.",
                    mail.MessageParts[0].BodyView,
                    "Body does not match");
            }

            // Now continue to Initialize Database
            IEInstance.Button(Find.ById("InstallWizard_StepNavigationTemplateContainerID_StepNextButton")).Click();

            // Initialize Database
            IEInstance.Button(Find.ById("InstallWizard_StepNavigationTemplateContainerID_StepNextButton")).ClickNoWait();

            IEInstance.WaitUntilContainsText("Create Board", 300);

            Assert.IsTrue(IEInstance.ContainsText("Create Board"));

            // Board Settings
            IEInstance.TextField(Find.ById("InstallWizard_TheForumName")).TypeText(TestConfig.TestApplicationName);
            IEInstance.TextField(Find.ById("InstallWizard_ForumEmailAddress")).TypeText(TestConfig.TestForumMail);

            // Admin User
            IEInstance.TextField(Find.ById("InstallWizard_UserName")).TypeText(TestConfig.AdminUserName);
            IEInstance.TextField(Find.ById("InstallWizard_AdminEmail")).TypeText(TestConfig.TestForumMail);
            IEInstance.TextField(Find.ById("InstallWizard_Password1")).TypeText(TestConfig.AdminPassword);
            IEInstance.TextField(Find.ById("InstallWizard_Password2")).TypeText(TestConfig.AdminPassword);
            IEInstance.TextField(Find.ById("InstallWizard_SecurityQuestion")).TypeText(TestConfig.AdminPassword);
            IEInstance.TextField(Find.ById("InstallWizard_SecurityAnswer")).TypeText(TestConfig.AdminPassword);

            IEInstance.Button(Find.ById("InstallWizard_StepNavigationTemplateContainerID_StepNextButton")).ClickNoWait();

            IEInstance.WaitUntilContainsText("Setup/Upgrade Finished", 300);

            Assert.IsTrue(IEInstance.ContainsText("Setup/Upgrade Finished"));

            IEInstance.Button(Find.ById("InstallWizard_FinishNavigationTemplateContainerID_FinishButton")).ClickNoWait();

            IEInstance.WaitUntilContainsText("Welcome Guest!", 300);

            Assert.IsTrue(IEInstance.ContainsText("Welcome Guest!"), "Installation failed");
        }
开发者ID:mukhtiarlander,项目名称:git_demo_torit,代码行数:93,代码来源:TestSetup.cs


注:本文中的WatiN.Core.IE.ShowWindow方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。