public void ScrollToView()
 {
     NavigationHelper.NavigateToUrl("http://qa.conventionbureau.london/search-accommodation");
     Thread.Sleep(5000);
     JavaScriptExecutor.ScrollToView(By.XPath(".//*[@id='list']/ul/li[3]/div/h3/a"));
     Thread.Sleep(1000);
 }
Beispiel #2
0
        public void ThenIShouldSeeAndInSearchReuslt(string p0, string p1)
        {
            try
            {
                Thread.Sleep(5000);
                JavaScriptExecutor.ScrollToView(By.XPath(".//*[@id='list']/ul/li[9]/div/h3/a"));
                Assert.IsTrue(GenericHelper.GetElement(By.XPath(".//*[@id='list']/ul/li[9]/div/h3/a")).Text.Contains(p0));
            }
            catch (Exception e)
            {
                Logger.Error("Exception: " + e);
                Assert.Fail("Exception" + e);
                throw;
            }

            try
            {
                Thread.Sleep(5000);
                JavaScriptExecutor.ScrollToView(By.XPath(".//*[@id='list']/ul/li[18]/div/h3/a"));
                Assert.IsTrue(GenericHelper.GetElement(By.XPath(".//*[@id='list']/ul/li[18]/div/h3/a")).Text.Contains(p1));
            }
            catch (Exception e)
            {
                Logger.Error("Exception: " + e);
                Assert.Fail("Exception" + e);
                throw;
            }
        }
        public void ThenIShouldSeeSearchResults(string p0)
        {
            try
            {
                string keyword = p0;

                switch (keyword)
                {
                case "Qa":

                    Thread.Sleep(5000);
                    JavaScriptExecutor.ScrollToView(By.XPath(".//*[@id='list']/ul/li[4]/div/h3/a"));
                    Thread.Sleep(5000);
                    Assert.IsTrue(GenericHelper.GetElement(By.XPath(".//*[@id='list']/ul/li[4]/div/h3/a")).Text.Contains("Amba Hotel"));
                    break;

                case "Preview":
                    Thread.Sleep(5000);
                    JavaScriptExecutor.ScrollToView(By.XPath(".//*[@id='list']/ul/li[1]/div/h3/a"));
                    Thread.Sleep(5000);
                    Assert.IsTrue(GenericHelper.GetElement(By.XPath(".//*[@id='list']/ul/li[1]/div/h3/a")).Text.Contains("100 Queen's Gate Hotel"));
                    break;

                default:
                    Console.WriteLine("No Matching Text Found");
                    break;
                }
            }
            catch (Exception e)
            {
                Logger.Error("Exception: " + e);
                Assert.Fail("Exception" + e);
                throw;
            }
        }
Beispiel #4
0
        public void ThenIShouldSeeSearchResultsForContainingTheKeyword(string p0, string p1)
        {
            try
            {
                string url = p0;

                switch (url)
                {
                case "Natural Museum":

                    Thread.Sleep(5000);
                    //JavaScriptExecutor.ScrollToWebElement(By.XPath(".//*[@class='search-tile-title']/a"));
                    JavaScriptExecutor.ScrollToView(By.XPath(".//*[@class='search-grid-results']/li[1]/div[1]/div/h3/a"));
                    Assert.IsTrue(GenericHelper.GetElement(By.XPath(".//*[@class='search-grid-results']/li[1]/div[1]/div/h3/a")).Text.Contains(p1));
                    //ButtonHelper.ClickButton(By.XPath(".//*[@class='search-grid-results']/li[1]/div[1]/div/h3/a"));
                    break;

                case "Science Museum":
                    Thread.Sleep(5000);
                    JavaScriptExecutor.ScrollToView(By.XPath(".//*[@class='search-grid-results']/li[1]/div[1]/div/h3/a"));
                    Assert.IsTrue(GenericHelper.GetElement(By.XPath(".//*[@class='search-grid-results']/li[1]/div[1]/div/h3/a")).Text.Contains(p1));
                    break;

                case "Premier Inn":
                    Thread.Sleep(5000);
                    JavaScriptExecutor.ScrollToView(By.XPath(".//*[@class='search-grid-results']/li[1]/div[1]/div/h3/a"));
                    Assert.IsTrue(GenericHelper.GetElement(By.XPath(".//*[@class='search-grid-results']/li[1]/div[1]/div/h3/a")).Text.Contains(p1));
                    break;

                /*   case "Holiday Inn":
                 *   Thread.Sleep(5000);
                 *   JavaScriptExecutor.ScrollToView(By.XPath(".//*[@class='search-grid-results']/li[1]/div[1]/div/h3/a"));
                 *   Assert.IsTrue(GenericHelper.GetElement(By.XPath(".//*[@class='search-grid-results']/li[1]/div[1]/div/h3/a")).Text.Contains(p1));
                 *   break;
                 * case "Harry Potter":
                 *   Thread.Sleep(5000);
                 *   JavaScriptExecutor.ScrollToView(By.XPath(".//*[@class='search-grid-results']/li[1]/div[1]/div/h3/a"));
                 *   Assert.IsTrue(GenericHelper.GetElement(By.XPath(".//*[@class='search-grid-results']/li[1]/div[1]/div/h3/a")).Text.Contains(p1));
                 *   break;*/
                default:
                    Console.WriteLine("No Matching Text Found");
                    break;
                }
            }
            catch (Exception e)
            {
                Logger.Error("Exception: " + e);
                Assert.Fail("Exception" + e);
                throw;
            }
        }
 public void ThenIShouldSeeSearchResults()
 {
     try
     {
         Thread.Sleep(5000);
         JavaScriptExecutor.ScrollToView(By.XPath(".//*[@id='list']/ul/li[3]/div/h3/a"));
         Thread.Sleep(5000);
         Assert.IsTrue(GenericHelper.GetElement(By.XPath(".//*[@id='list']/ul/li[3]/div/h3/a")).Text.Contains("AMBA Hotel Charing Cross"));
     }
     catch (Exception e)
     {
         Logger.Error("Exception: " + e);
         Assert.Fail("Exception" + e);
     }
 }
Beispiel #6
0
 public void WhenIClickOnNextPaginationButton()
 {
     try
     {
         Thread.Sleep(5000);
         JavaScriptExecutor.ScrollToView(By.XPath(".//*[@id='content']/div/div[2]/div/div[2]"));
         ButtonHelper.ClickButton(By.XPath(".//*[@class='course-search-submit']"));
         Thread.Sleep(5000);
     }
     catch (Exception e)
     {
         Logger.Error("Exception: " + e);
         Assert.Fail("Exception" + e);
         throw;
     }
 }