Esempio n. 1
0
        public HomePage Follow(string name)
        {
            name = name.ToLower();
            this.Navigate();

            _followsButton.Click();
            WebElementHelper.ValueInput(_suggetionInput, name);
            if (!WebElementHelper.HasElementIn(_driver, _suggestionContainer, By.Id(name), TimeSpan.FromSeconds(10)))
            {
                throw new MessageException("Profile not found");
            }

            IWebElement element      = _suggestionContainer.FindElement(By.Id(name));
            IWebElement followButton = element.FindElement(By.ClassName(FOLLOW_BUTTON_CLASS));

            string followButtonText = followButton.Text;

            if (followButtonText == FOLLOW_BUTTON_UNSUBSCRIBE)
            {
                throw new MessageException("Already subscribed");
            }

            followButton.Click();
            while (!WebElementHelper.HasElementIn(_driver, _followContainer, By.Id(name), TimeSpan.FromSeconds(1)))
            {
                ;
            }

            return(this);
        }