Esempio n. 1
0
 public void GoToDoYouHaveAStory_page()
 {
     News.Click();
     More.Click();
     HaveYouSay.Click();
     DoYouHaveAStory.Click();
 }
Esempio n. 2
0
 public void RegisterUser(string firstName, string lastName, string nickName, string phone, string country, string city, string ulica, int gender)
 {
     FirstName.SendKeys(firstName + TestData_String);
     LastName.SendKeys(lastName + TestData_String);
     NickName.SendKeys(nickName);
     Email.SendKeys(TestData_Email);
     Phone.SendKeys(phone);
     Country.SelectByText(country);
     City.SelectByText(city);
     Ulica.SendKeys(ulica);
     Gender(gender);
     News.Click();
     Promotion.Click();
     RegisterButton.Click();
 }
Esempio n. 3
0
        public NewsPage ClickNews()
        {
            // Wait for the news animation to finish
            log.Info("Waiting for news animation to finish");

            int previousHeight = -1;
            int newHeight      = News.Size.Height;

            new WebDriverWait(driver, TimeSpan.FromSeconds(5)).Until(d =>
            {
                if (newHeight == previousHeight)
                {
                    log.Info("News Animation finished");
                    return(true);
                }
                else
                {
                    previousHeight = newHeight;
                    newHeight      = News.Size.Height;
                    log.Info($"News height changed: {News.Size.Height}");
                    return(false);
                }
            });

            //new WebDriverWait(driver, TimeSpan.FromSeconds(2)).Until(d =>
            //    {
            //        int previousHeight = -1;
            //        int newHeight = News.Size.Height;
            //        Stopwatch timeout = new Stopwatch();
            //        timeout.Start();
            //        while (newHeight != previousHeight)
            //        {
            //            Thread.Sleep(500);
            //            previousHeight = newHeight;
            //            newHeight = News.Size.Height;
            //            log.Info($"News height changed: {News.Size.Height}");
            //            if (timeout.Elapsed > TimeSpan.FromSeconds(2)) throw new TimeoutException("Timeout while waiting for the news animation to finish");
            //        }
            //        log.Info("News Animation finished");
            //        return true;
            //    });

            log.Info("Clicking news");
            News.Click();
            return(new NewsPage(driver));
        }
        public void GoTo(string siteLocation)
        {
            string expectedPageTitle;

            switch (siteLocation)
            {
            case "BBCHome":
                BBCHome.Click();
                expectedPageTitle = "BBC - Home";
                break;

            case "NewsHome":
                News.Click();
                expectedPageTitle = "Home - BBC News";
                break;

            case "SportsHome":
                Sport.Click();
                expectedPageTitle = "BBC Sport - Sport";
                break;

            case "FootballHome":
                Football.Click();
                expectedPageTitle = "BBC Sport - Football";
                break;

            default:
                expectedPageTitle = "Unknown location";
                break;
            }

            var wait = Browser.Wait();

            try
            {
                wait.Until(p => p.Title == expectedPageTitle);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                throw;
            }
        }
 public NewsPObject NavigateToNews()
 {
     News.Click();
     return(DoInitialize.PageElementsIn <NewsPObject>());
 }