コード例 #1
0
 /// <summary>
 /// CloseStoreLocatorPopupWindow clicks on close icon of doctors entry popup
 /// </summary>
 /// <param name="Driver">Initialized RemoteWebDriver instance</param>
 /// <param name="reporter"></param>
 public static void CloseStoreLocatorPopupWindow(RemoteWebDriver driver, Iteration reporter, string resultsPath)
 {
     try
     {
         reporter.Add(new Act("Close Store Locator Popup Window"));
         //Selenide.SwitchToDefaultContent(driver);
         //Selenide.SwitchToFrame(driver, Locator.Get(LocatorType.ID, "dlg_ifrm_search"));
         Selenide.WaitForElementNotVisible(driver, Locator.Get(LocatorType.ClassName, "dlg_spinner"));
         if (Selenide.IsElementExists(driver, Locator.Get(LocatorType.ID, "createmsgdiv")))
         {
             CommonPage.AcceptErrorMessageIfPresent(driver, reporter, resultsPath);
         }
         //if (Selenide.IsElementExists(driver, Util.GetLocator("Cancel_btn")))
         //{
         //    Selenide.Click(driver, Util.GetLocator("Cancel_btn"));
         //}
         if (Selenide.IsElementExists(driver, Util.GetLocator("StoreInfoCloseBtn_win")))
         {
             Selenide.Click(driver, Util.GetLocator("StoreInfoCloseBtn_win"));
         }
         //CommonPage.WaitUntilSpinnerDisappears(driver);
         //CommonPage.AcceptOrDissmissAlertIfPresent(driver, reporter);
         //CommonPage.AcceptErrorMessageIfPresent(driver);
         Selenide.SwitchToDefaultContent(driver);
     }
     catch (Exception ex)
     {
         CommonPage.AcceptOrDissmissAlertIfPresent(driver, reporter);
         CommonPage.AcceptErrorMessageIfPresent(driver, reporter, resultsPath);
     }
 }
コード例 #2
0
        /// <summary>
        /// ClickOnAnyStoreNumber method clicks on store number in the results
        /// </summary>
        /// <param name="driver"></param>
        /// <param name="reporter"></param>
        /// <param name="resultsPath"></param>
        public static void ClickOnAnyStoreNumber(RemoteWebDriver driver, Iteration reporter, string resultsPath)
        {
            try
            {
                reporter.Add(new Act("Click on store number in results of Stores Directory Page"));
                //Selenide.SwitchToFrame(driver, Locator.Get(LocatorType.ID, "iFrameSiteContents"));
                if (Selenide.IsElementExists(driver, Locator.Get(LocatorType.XPath, "//table[@class='formview']/descendant::tr[2]/td//a/nobr")))
                {
                    Selenide.Click(driver, Locator.Get(LocatorType.XPath, ("//table[@class='formview']/descendant::tr[2]/td//a/nobr")));
                }
                else if (Selenide.IsElementExists(driver, Locator.Get(LocatorType.XPath, "//table[@class='formview']/descendant::tr[2]/td//a")))
                {
                    Selenide.Click(driver, Locator.Get(LocatorType.XPath, ("//table[@class='formview']/descendant::tr[2]/td//a")));
                }
                else
                {
                    reporter.Add(new Act("Results not found"));
                }

                Selenide.WaitForElementNotVisible(driver, Locator.Get(LocatorType.ClassName, "dlg_spinner"));
                //WaitForPageLoad(driver, 10);
                //CommonPage.WaitUntilSpinnerDisappears(driver);
                CommonPage.AcceptOrDissmissAlertIfPresent(driver, reporter);
                CommonPage.AcceptErrorMessageIfPresent(driver, reporter, resultsPath);
                //Selenide.SwitchToFrame(driver,Locator.Get(LocatorType.ID, "dlg_ifrm_search"));
                Selenide.SwitchToDefaultContent(driver);
            }

            catch (SystemException sysex)
            {
                //    this.Reporter.Chapter.Step.Action.Extra = sysex.Message + "<br/>" + sysex.StackTrace;
                //    Reporter.Chapter.Step.Action.IsSuccess = false;
                CommonPage.AcceptOrDissmissAlertIfPresent(driver, reporter);
                CommonPage.AcceptErrorMessageIfPresent(driver, reporter, resultsPath);
            }
        }