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


C# ISelenium.Click方法代码示例

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


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

示例1: SetupClass

        public void SetupClass()
        {
            base.StartServer();
            selenium = new DefaultSelenium("localhost", 4444, "*chrome", ConfigurationManager.AppSettings["baseUrl"]);
            selenium.Start();
            verificationErrors = new StringBuilder();

            selenium.DeleteAllVisibleCookies();

            selenium.Open("/dna/mbfood/");
            // To Do
            // too general, could crash test if a topic happened to have the wrong name 
            Assert.IsFalse(selenium.IsTextPresent("error"));
            Assert.IsFalse(selenium.IsTextPresent("There has been a problem"));

            selenium.Click("link=Sign in");
            selenium.Click("bbcid_username");
            selenium.Type("bbcid_username", "mpgsuper");
            selenium.Type("bbcid_password", "ratbags");
            selenium.Click("signin");
            selenium.WaitForPageToLoad("30000");

            // going this way so as to be certain to get the right site options without thinking about it
            selenium.Click("link=Site Options");
            selenium.WaitForPageToLoad("30000");

            // check a) where we are b) BBC site requirements for page titles https://confluence.dev.bbc.co.uk/display/DNA/Meta+Data - note that this title breaks those guidelines
            Assert.AreEqual("BBC - Food - DNA Administration - Site Options - Food", selenium.GetTitle());
            Assert.IsTrue(selenium.IsElementPresent("//input[@name='sov_49_General_CustomBarlesquePath']");

            stateOfOption = selenium.GetValue("//input[@name='so_49_General_CustomBarlesquePath' and @type='radio' and @checked='']/@value");
            valueOfOption = selenium.GetValue("//input[@name='so_49_General_CustomBarlesquePath' and @type='text']");
        }
开发者ID:rocketeerbkw,项目名称:DNA,代码行数:33,代码来源:CustomBarlesque.cs

示例2: Login

        public void Login()
        {
            selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://127.0.0.1:1556/");
            selenium.Start();

            selenium.Open("/");
            selenium.Type("id=loginUsername", "prof");
            selenium.Type("id=loginPassword", "prof");
            selenium.Click("//div[@id='logindisplay']/form[2]/input[3]");
            selenium.WaitForPageToLoad("30000");
            selenium.Click("link=Courses");
            selenium.WaitForPageToLoad("30000");
        }
开发者ID:supermuk,项目名称:iudico,代码行数:13,代码来源:StudentRole.cs

示例3: Login

        public void Login()
        {
            selenium = new DefaultSelenium("localhost", 4444, "*chrome", ConfigurationManager.AppSettings["SELENIUM_URL"]);
                selenium.Start();

            selenium.Open("/");
            selenium.Type("id=loginUsername", "lex");
            selenium.Type("id=loginPassword", "lex");
            selenium.Click("//div[@id='logindisplay']/form[2]/input[3]");
            selenium.WaitForPageToLoad("30000");
            selenium.Click("//a[contains(@href, 'UserActivity/Index')]");
            selenium.WaitForPageToLoad("30000");
        }
开发者ID:supermuk,项目名称:iudico,代码行数:13,代码来源:SecuritySeleniumTester.cs

示例4: Login

        public void Login()
        {
            selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://127.0.0.1:1556/");
            selenium.Start();

            selenium.Open("/");
            selenium.Type("id=loginUsername", "lex");
            selenium.Type("id=loginPassword", "lex");
            selenium.Click("//div[@id='logindisplay']/form[2]/input[3]");
            selenium.WaitForPageToLoad("30000");
            selenium.Click("//a[contains(@href, 'UserActivity/Index')]");
            selenium.WaitForPageToLoad("30000");
        }
开发者ID:supermuk,项目名称:iudico,代码行数:13,代码来源:SecuritySeleniumTester.cs

示例5: Login

        public void Login()
        {
            selenium = new DefaultSelenium("localhost", 4444, "*chrome", ConfigurationManager.AppSettings["SELENIUM_URL"]);
            selenium.Start();

            selenium.Open("/");
            selenium.Type("id=loginUsername", "prof");
            selenium.Type("id=loginPassword", "prof");
            selenium.Click("//div[@id='logindisplay']/form[2]/input[3]");
            selenium.WaitForPageToLoad("40000");
            selenium.Click("link=Courses");
            selenium.WaitForPageToLoad("40000");
        }
开发者ID:supermuk,项目名称:iudico,代码行数:13,代码来源:StudentRole.cs

示例6: Init

        public void Init()
        {
            //Deleting cookies in ie browser through command line.
            /*var procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2");
            var proc = new System.Diagnostics.Process { StartInfo = procStartInfo };
            proc.Start();
            WebDriverObj = new InternetExplorerDriver();
            */
            string URL = "https://stg-gib.ladbrokes.com/admin";
            WebDriverObj = new FirefoxDriver();
            MyBrowser = new WebDriverBackedSelenium(WebDriverObj, URL);
            MyBrowser.Start();
            WebDriverObj.Manage().Window.Maximize();
            MyBrowser.WindowMaximize();

            MyBrowser.Open(URL);
            MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
            MyBrowser.Refresh();
            MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
            MyBrowser.Type(TestDataCreation.ControlsRepository.UsrNmeTxtBx, "Automation1");
            MyBrowser.Type(TestDataCreation.ControlsRepository.PwdTxtBx, "aditi123");
            MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
            MyBrowser.Click(TestDataCreation.ControlsRepository.LoginBtn);
            MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
        }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:25,代码来源:TestDataBase.cs

示例7: ValidatePopupsofNFR

        ///<summary>
        /// This method Clicks on the NRF links and validates the URl opened in the new browser
        /// <example>ValidatePopupsofNFR(MyBrowser, "xPath", "Ladbrokes LBR", "https://www.gibraltar.gov.gi/remotegambling");
        public void ValidatePopupsofNFR(ISelenium browser, string xPath, string newWindowTitle, string expURL)
        {
            try
            {
                browser.Click(xPath);
                HGframeworkCommonObj.PageSync(browser);
                HGframeworkCommonObj.WaitUntilElementPresent(browser, LoginLogoutControls.alertContainer, "5000");
                Thread.Sleep(1000);
                Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.alertContainer), "Alert container was not displayed on tapping the '" + xPath + "' link");
                Assert.IsTrue(browser.IsTextPresent("You are about to navigate away from the site and any selections you have in the betslip may be lost"), "Warning message[1] is not displayed in the Alert container");
                Assert.IsTrue(browser.IsTextPresent("Do you want to navigate away?"), "Warning message[2] is not displayed in the Alert container");
                browser.Click(LoginLogoutControls.CloseButtonInAlertContainer);
                HGframeworkCommonObj.PageSync(browser);
                Assert.IsFalse(browser.IsVisible(LoginLogoutControls.alertContainer), "Alert container failed to close on tapping the Cancel button");

                browser.Click(xPath);
                HGframeworkCommonObj.WaitUntilElementPresent(browser, LoginLogoutControls.alertContainer, "5000");
                Thread.Sleep(1000);
                Assert.IsTrue(browser.IsElementPresent(LoginLogoutControls.alertContainer), "Alert container was not displayed on tapping the '" + xPath + "' link");
                browser.Click(LoginLogoutControls.ContinueButtonInAlertContainer);
                HGframeworkCommonObj.PageSync(browser);
                Thread.Sleep(2000);
                HGFcommonObj.SwitchWindow(browser, newWindowTitle);

                string actUrl = browser.GetLocation();
                // url = driver.Url;
                browser.Close();
                browser.SelectWindow("null");
                Thread.Sleep(1000);

                if (actUrl.ToLower().Trim() != expURL.ToLower().Trim())
                {
                    Console.WriteLine("Mismatch in URL's. Actual '" + actUrl + "',  Expected '" + expURL + "'.");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Function 'ValidatePopupsofNFR' - Failed");
                Console.WriteLine(ex.Message);
                Fail(ex.Message);
            }
        }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:45,代码来源:HomeGlobalFunctions.cs

示例8: Google_For_SimpleTalk

        public void Google_For_SimpleTalk(SeleniumProvider seleniumProvider)
        {
            Browser = seleniumProvider.GetBrowser();

            Browser.Open("/");
            Browser.Type("q", "Simple Talk");
            Browser.Click("btnG");

            Browser.WaitForPageToLoad("3000");

            Assert.True(Browser.IsTextPresent("www.simple-talk.com"));
        }
开发者ID:benadderson,项目名称:xUnitBrowserTheoriesForSelenium,代码行数:12,代码来源:Example.cs

示例9: SetupTest

        public void SetupTest()
        {
            selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://127.0.0.1:1556/");
            selenium.Start();
            verificationErrors = new StringBuilder();

            selenium.Open("/");
			selenium.Type("id=loginPassword", "lex");
			selenium.Type("id=loginUsername", "lex");
            selenium.Click("//div[@id='logindisplay']/form[2]/input[3]");
            selenium.WaitForPageToLoad("30000");
        }
开发者ID:supermuk,项目名称:iudico,代码行数:12,代码来源:UniqueUserId.cs

示例10: TestMethod3

 public void TestMethod3()
 {
     string URL = "http://www.abb.com";
     selenium = new DefaultSelenium("localhost", 4444, "*firefox", URL);
     selenium.Start();
     selenium.Open("/");
     Assert.AreEqual("The ABB Group - Automation and Power Technologies", selenium.GetTitle());
     selenium.Type("searchInput", "Robot");
     selenium.Click("search");
     selenium.WaitForPageToLoad("10000");
     Assert.AreEqual("The ABB Group", selenium.GetTitle());
     Assert.AreEqual("Robot", selenium.GetValue("searchInput"));
 }
开发者ID:shivanisharma,项目名称:test,代码行数:13,代码来源:UnitTest1.cs

示例11: Init

 public void Init()
 {
     FfDriver = new FirefoxDriver();
     MyBrowser = new WebDriverBackedSelenium(FfDriver, "https://stg-gib.ladbrokes.com/admin");
     MyBrowser.Start();
     MyBrowser.Open("https://stg-gib.ladbrokes.com/admin");
     MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
     MyBrowser.Type(AdminSuite.CommonControls.AdminHomePage.UsrNmeTxtBx, "sanjeeva_p");
     MyBrowser.Type(AdminSuite.CommonControls.AdminHomePage.PwdTxtBx, "123456");
     MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
     MyBrowser.Click(AdminSuite.CommonControls.AdminHomePage.LoginBtn);
     MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
 }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:13,代码来源:AdminBase.cs

示例12: clickObject_MobileLobby

 ///<summary>
 /// This method clicks on any desired object(button, link)
 /// <example>clickObject_MobileLobby(browser, xPath)</example>        
 public void clickObject_MobileLobby(ISelenium browserObj, string strLocator)
 {
     try
     {
         Assert.IsTrue(browserObj.IsVisible(strLocator), strLocator + " element is not present");
         browserObj.Focus(strLocator);
         browserObj.Click(strLocator);
         WaitForLoadingIcon_MobileLobby(browserObj, Convert.ToInt32(FrameGlobals.IconLoadTimeout));
     }
     catch (Exception ex)
     {
         Console.WriteLine("Function 'clickObject' - Failed");
         Console.WriteLine(ex.Message);
         Fail(ex.Message);
     }
 }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:19,代码来源:MobileLobbyFunctions.cs

示例13: TestMethod1

        public void TestMethod1()
        {
            selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://www.google.com/");
            selenium.Start();

            selenium.Open("/");
            selenium.Type("q", "selenium rc");
            selenium.Click("btnG");
            selenium.WaitForPageToLoad("30000");
            Assert.AreEqual("selenium rc - Google Search", selenium.GetTitle());

            try
            {
                selenium.Stop();
            }
            catch (Exception)
            {
                // Ignore errors if unable to close the browser
            }
        }
开发者ID:shivanisharma,项目名称:test,代码行数:20,代码来源:UnitTest1.cs

示例14: TestMethod2

        public void TestMethod2()
        {
            selenium = new DefaultSelenium("localhost", 4444, "*iexplore", "http://localhost:1987");
            selenium.Start();
            selenium.Open("/WebSite1/");
            selenium.Type("MainContent_TextBox1", "HUM");
            selenium.Click("MainContent_Button1");
            selenium.WaitForPageToLoad("3000770");

            //Get the Table Value of Row 1 and Coulumn 2
            object GG = selenium.GetTable("MainContent_GridView1.1.2");

            Assert.AreEqual("1", "1");
            try
            {
                selenium.Stop();
            }
            catch (Exception)
            {
                // Ignore errors if unable to close the browser
            }
        }
开发者ID:shivanisharma,项目名称:test,代码行数:22,代码来源:UnitTest1.cs

示例15: RegisterCustomer_selfExclusion

        ///<summary>
        /// This method creates a customer with the same details of a self exclusion customer
        /// <example>RegisterCustomer_selfExclusion(portalbrowser, adminbrowser) </example>
        public void RegisterCustomer_selfExclusion(ISelenium browser, ISelenium adminBrowser)
        {
            try
            {
                string regMsg, gender, xPath;
                var admincommonObj = new AdminSuite.Common();
                Random rnd = new Random();
                int rndNumber = rnd.Next(10000);

                //get details of customer in OB
                adminBrowser.WindowFocus();
                string username = "AutoUser" + rndNumber;
                admincommonObj.SelectMainFrame(adminBrowser);
                string firstname = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'First Name:')]/following-sibling::td");
                string lastname = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Last Name:')]/following-sibling::td");
                string title = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Title:')]/following-sibling::td");
                if (title.ToLower() == "mr")
                {
                    gender = "male";
                }
                else
                {
                    gender = "female";
                }

                string dob = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Date of Birth:')]/following-sibling::td");
                string[] arr = dob.Split('-');
                string DOByear = arr[0];
                System.Globalization.DateTimeFormatInfo mfi = new System.Globalization.DateTimeFormatInfo();
                string DOBmonth = mfi.GetMonthName(int.Parse(arr[1])).ToString();
                string DOBday = arr[2];

                string houseno = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Address (1)')]/following-sibling::td");
                string postcode = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Postcode:')]/following-sibling::td");

                string address1 = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), '(2)')]/following-sibling::td") + adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), '(3)')]/following-sibling::td");
                string address2 = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), '(3)')]/following-sibling::td");
                string city = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'City:')]/following-sibling::td");
                string email = adminBrowser.GetText("//tr/td[@class='caption' and contains(text(), 'Email:')]/following-sibling::td");
                string teleCode = "+44";
                string telnumber = "1234567890";
                string mobnumber = "1234512345";

                string password = "12345678";
                string confirmPassword = "12345678";
                string securityQuestion = "Favourite Colour";
                string securityAnswer = "Blue";

                string accountCurrency = "UK Pound Sterling";
                string country = "United Kingdom";

                browser.WindowFocus();
                WaitForLoadingIcon_MobileLobby(browser, FrameGlobals.IconLoadTimeout);
                Assert.IsTrue(browser.IsVisible(MobileLobbyControls.registrationTitle), "Registration Page is not displayed");

                //Enter data in all the fields
                browser.Type(MobileLobbyControls.promocode, "");
                browser.Select(MobileLobbyControls.title, title);
                browser.Type(MobileLobbyControls.firstname, firstname);
                browser.Type(MobileLobbyControls.lastname, lastname);
                //gender
                if (gender.ToLower().Trim() == "male")
                {
                    browser.Click(MobileLobbyControls.genderMale);
                }
                else
                {
                    browser.Click(MobileLobbyControls.genderFemale);
                }

                browser.Select(MobileLobbyControls.DOBday, DOBday);
                browser.Select(MobileLobbyControls.DOBmonth, DOBmonth);
                browser.Select(MobileLobbyControls.DOByear, DOByear);
                browser.Select(MobileLobbyControls.country, country);

                browser.Type(MobileLobbyControls.housename, houseno);
                browser.Type(MobileLobbyControls.postcode, postcode);
                browser.Type(MobileLobbyControls.address1, address1);
                browser.Type(MobileLobbyControls.address2, address2);
                browser.Type(MobileLobbyControls.city, city);
                browser.Type(MobileLobbyControls.email, email);

                browser.Type(MobileLobbyControls.telintcode, teleCode);
                browser.Type(MobileLobbyControls.telnumber, telnumber);
                browser.Type(MobileLobbyControls.mobintcode, teleCode);
                browser.Type(MobileLobbyControls.mobnumber, mobnumber);
                browser.Select(MobileLobbyControls.accountCurrency, accountCurrency);

                browser.Type(MobileLobbyControls.username, username);
                browser.Type(MobileLobbyControls.password, password);
                browser.Type(MobileLobbyControls.confirmPassword, confirmPassword);
                browser.Select(MobileLobbyControls.securityQuestion, securityQuestion);
                browser.Type(MobileLobbyControls.securityAnswer, securityAnswer);
                MLcommonObj.SelectCheckbox(browser, MobileLobbyControls.contactMe, "on");
                MLcommonObj.SelectCheckbox(browser, MobileLobbyControls.aggreement, "on");
                Thread.Sleep(1000);

//.........这里部分代码省略.........
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:101,代码来源:MobileLobbyFunctions.cs


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