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


C# ISelenium.IsAlertPresent方法代码示例

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


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

示例1: UpdateSegments

        /// <summary>
        /// Updates a perticular segment value
        /// </summary>
        ///  Author: Kiran
        /// <param name="browser">browser Instance</param>
        /// <param name="userName">User Name</param>
        /// <param name="segmentType">HVC</param>
        /// <param name="segmentVal">Yes</param>
        public bool UpdateSegments(ISelenium adminBrowser, string userName, string segmentType, string segmentVal)
        {
            try
            {
                // Enter Customer Name and Search
                SearchCustomer(userName, adminBrowser);
                SelectMainFrame(adminBrowser);
                adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.updateSegment);
                adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);

                string xPath = "//tr/td[contains(text(), '" + segmentType + "')]/following-sibling::td/select";
                Assert.IsTrue(adminBrowser.IsElementPresent(xPath), "Element not found " + xPath);
                adminBrowser.Select(xPath, segmentVal);
                Thread.Sleep(1000);
                adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.updateSegmentandURL);
                adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                xPath = "//tr/td[@class='caption' and contains(text(), '" + segmentType + "')]/following-sibling::td[contains(text(), '" + segmentVal + "')]";
                if (segmentVal.ToLower().Contains("unset") || segmentVal.ToLower().Contains("no"))
                {
                    if (adminBrowser.IsAlertPresent())
                    {
                        adminBrowser.ChooseOkOnNextConfirmation();
                    }
                    xPath = "//tr/td[@class='caption' and contains(text(), '" + segmentType + "')]/following-sibling::td/i[contains(text(), '" + segmentVal + "')]";
                }
                adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                adminBrowser.Click(AdminSuite.CustomerCreation.CustomersPage.backBtn);
                adminBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
                Assert.IsTrue(adminBrowser.IsElementPresent(xPath), "Element not found " + xPath);
                return true;
            }
            catch (Exception ex)
            {
                CaptureScreenshot(adminBrowser, "");
                Fail(ex.Message);
                return false;
            }
        }
开发者ID:hemap,项目名称:PhoenixAutomationRepo,代码行数:46,代码来源:Common.cs

示例2: UploadCsvFilesToAdmin

        /// <summary>
        /// Uploads the specified csv files to create Events/Markets/Selections
        /// </summary>
        /// <param name="filepath">Exact file name along with full path</param>
        /// <param name="browser">Browser instance</param>
        public void UploadCsvFilesToAdmin(string filepath, ref ISelenium browser)
        {
            try
            {

                browser.SelectFrame("relative=top");
                browser.SelectFrame("TopBar");
                //browser.Click("//li[a[text()='Events']]/following-sibling::li[a[text()='Event Upload']]");
                IWebDriver driver = ((WebDriverBackedSelenium)browser).UnderlyingWebDriver;
                driver.FindElement(By.LinkText("Event Upload")).Click();
                browser.WaitForPageToLoad("60000");
                browser.SelectFrame("relative=top");
                browser.SelectFrame("MainArea");
                browser.WaitForPageToLoad("10000");
                string[] filename = filepath.Split('\\');
                Console.WriteLine(filename[filename.Length - 1] + " : Is the file name");

                switch (filename[filename.Length - 1])
                {
                    case "EVENTS.CSV":

                        //events,markets,selections,results,fbscores
                        browser.Select("name=filetype", "Events");
                        browser.Type("name=filename", filepath);

                        browser.Focus("//table/tbody/tr/th[@class='buttons' and @colspan='2']/input[@type='submit' and @value='Upload File' and @name='DoIt']");
                        browser.Click("//table/tbody/tr/th[@class='buttons' and @colspan='2']/input[@type='submit' and @value='Upload File' and @name='DoIt']");
                        browser.WaitForPageToLoad("10000");
                        Assert.IsTrue(browser.IsElementPresent("//td/a[(text()='EVENTS.CSV')]"), "");
                        browser.Click("//td/a[contains(text(),'EVENTS.CSV')]");
                        browser.WaitForPageToLoad("10000");
                        browser.Click("name=SetResult");
                        browser.WaitForPageToLoad("10000");

                        // to handle javascript pop up
                        if (browser.IsAlertPresent())
                            browser.ChooseOkOnNextConfirmation();
                        Thread.Sleep(2000);
                        //string fileUploadmsg = browser.GetText("//tr[@class=infoyes/tb/b");
                        //Console.WriteLine(fileUploadmsg + "is the message displayed after File upload, Expected message is 'File uploaded OK'");
                        browser.Click("//input[@value='Delete File']");
                        browser.WaitForPageToLoad("10000");
                        break;

                    case "market.CSV":

                        browser.Select("name=filetype", "Markets");//events,markets,selections,results,fbscores
                        browser.Type("name=filename", filepath);

                        browser.Focus("//table/tbody/tr/th[@class='buttons' and @colspan='2']/input[@type='submit' and @value='Upload File' and @name='DoIt']");
                        browser.Click("//table/tbody/tr/th[@class='buttons' and @colspan='2']/input[@type='submit' and @value='Upload File' and @name='DoIt']");//upload file
                        browser.WaitForPageToLoad("10000");
                        Assert.IsTrue(browser.IsElementPresent("//td/a[(text()='market.CSV')]"), "");
                        browser.Click("//td/a[contains(text(),'market.CSV')]");
                        browser.WaitForPageToLoad("10000");
                        browser.Click("name=SetResult");
                        browser.WaitForPageToLoad("10000");

                        /// to handle javascript pop up
                        if (browser.IsAlertPresent())
                            browser.ChooseOkOnNextConfirmation();

                        Thread.Sleep(2000);
                        //string fileUplodmsg = browser.GetText("//tr[@class=infoyes/tb/b");
                        //Console.WriteLine(fileUplodmsg + "is the message displayed after File upload, Expected message is 'File uploaded OK'");
                        browser.Click("//input[@value='Delete File']");
                        browser.WaitForPageToLoad("10000");
                        break;

                    case "SELECTIONS.CSV":

                        browser.Select("name=filetype", "Selections");//events,markets,selections,results,fbscores
                        browser.Type("name=filename", filepath);

                        browser.Focus("//table/tbody/tr/th[@class='buttons' and @colspan='2']/input[@type='submit' and @value='Upload File' and @name='DoIt']");
                        browser.Click("//table/tbody/tr/th[@class='buttons' and @colspan='2']/input[@type='submit' and @value='Upload File' and @name='DoIt']");//upload file
                        browser.WaitForPageToLoad("10000");
                        Assert.IsTrue(browser.IsElementPresent("//td/a[(text()='SELECTIONS.CSV')]"), "");
                        browser.Click("//td/a[contains(text(),'SELECTIONS.CSV')]");
                        browser.WaitForPageToLoad("10000");
                        browser.Click("name=SetResult");
                        browser.WaitForPageToLoad("10000");

                        Thread.Sleep(2000);
                        /// to handle javascript pop up
                        if (browser.IsAlertPresent())
                            browser.ChooseOkOnNextConfirmation();

                        Thread.Sleep(2000);
                        //string fileUplodmessage = browser.GetText("//tr[@class=infoyes/tb/b");
                        //Console.WriteLine(fileUplodmessage + "is the message displayed after File upload, Expected message is 'File uploaded OK'");
                        browser.Click("//input[@value='Delete File']");
                        browser.WaitForPageToLoad("10000");
                        break;

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


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