예제 #1
0
        public HomePage Unfollow(string name)
        {
            name = name.ToLower();
            _followsButton.Click();

            if (!WebElementHelper.HasElementIn(_driver, _followContainer, By.ClassName(FOLLOW_CARD),
                                               TimeSpan.FromSeconds(1)))
            {
                throw new MessageException("Follow is empty");
            }

            if (!WebElementHelper.HasElementIn(_driver, _followContainer, By.Id(name),
                                               TimeSpan.FromSeconds(1)))
            {
                throw new MessageException("Profile not found");
            }

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

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

            return(this);
        }
예제 #2
0
        public bool AddNewUser(BimTrackUser bimUser)
        {
//            IWebElement weTarget = GetRoot().FindElement(By.XPath("//input[@data-testid='validEmailCell']"));
//            weTarget.SendKeys(BimEmailProcessor.EMAILS_PREFIX + szUserSuffix +
//                              BimEmailProcessor.EMAILS_DOMAIN);
            var random = new Random();

            Thread.Sleep(random.Next(250, 500));
            _SetNewUserEmail(bimUser.email);
            Thread.Sleep(random.Next(250, 500));
            _SetNewUserRole(bimUser.isAdmin);
            Thread.Sleep(random.Next(250, 500));
            _ClickAddOrCancel(true, false);



            //TODO: Replace by ID, dependant on localized resource
            // Wait for a maximum time of x milliseconds for the out of users available message to pop in case the
            // maximum of users was reached
            const string warning = "You can not choose this plan. The hub user limit is reached.";
            var          byElem  = By.XPath(".//span[text() ='" + warning + "']");
            var          retElem = WebElementHelper.WaitUntilVisible(byElem, 2500);

            if (retElem != null)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
예제 #3
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);
        }
예제 #4
0
        public List <FollowUser> GetFollows()
        {
            _followsButton.Click();

            if (!WebElementHelper.HasElementIn(_driver, _followContainer, By.ClassName(FOLLOW_CARD),
                                               TimeSpan.FromSeconds(1)))
            {
                throw new MessageException("Follow is empty");
            }

            ReadOnlyCollection <IWebElement> elements = _followContainer.FindElements(By.ClassName(FOLLOW_CARD));
            List <FollowUser> users = new List <FollowUser>();

            foreach (var element in elements)
            {
                string     name = element.FindElement(By.ClassName(FOLLOW_NICKNAME_CLASS)).Text;
                FollowUser user = new FollowUser()
                {
                    Name = name
                };

                users.Add(user);
            }

            return(users);
        }
예제 #5
0
        public List <Post> GetPosts()
        {
            _newsButton.Click();

            if (WebElementHelper.HasElement(_driver, By.ClassName(NO_FOLLOWS_CLASS), TimeSpan.FromSeconds(2)))
            {
                throw new MessageException("No follows");
            }

            if (!WebElementHelper.HasElementIn(_driver, _masonryContainer, By.ClassName(POST_CLASS), TimeSpan.FromSeconds(10)))
            {
                throw new MessageException("Posts not found");
            }

            ReadOnlyCollection <IWebElement> elements = _masonryContainer.FindElements(By.ClassName(POST_CLASS));
            List <Post> posts = new List <Post>();

            foreach (var element in elements)
            {
                string accountName  = element.FindElement(By.ClassName(POST_ACCOUNT_NAME_CLASS)).Text;
                string accountLogin = element.FindElement(By.ClassName(POST_ACCOUNT_LOGIN_CLASS)).Text;
                string contentText  = element.FindElement(By.ClassName(POST_CONTENT_TEXT_CLASS))
                                      .FindElement(By.TagName("p")).Text;
                Post post = new Post()
                {
                    Name  = accountName,
                    Login = accountLogin,
                    Text  = contentText
                };

                posts.Add(post);
            }

            return(posts);
        }
예제 #6
0
            public void ClickCreateButton()
            {
                IWebElement weTemp = WebElementHelper.SafeFindElementDisplayed(By.Id(this.button_create_id));

//                CTX.driver.FindElement(By.Id(this.button_create_id)).Click();
                weTemp.Click();
            }
예제 #7
0
        public void GetCitiesCodeList()
        {
            Driver.Navigate().GoToUrl(mainPageUrl);
            WebElementHelper.WaitAndClick(Driver, By.XPath(citiesTableXPath));

            var tmpList = Driver.FindElements(By.XPath(cityXPath));

            List <string> cityCodeList = new List <string>();
            List <string> draftList    = new List <string>();

            foreach (var k in tmpList)
            {
                string[] cityArr = k.Text.Split('\n');
                draftList.AddRange(cityArr);
            }

            foreach (string a in draftList)
            {
                Match m = Regex.Match(a, pattern);
                if (m.Success)
                {
                    cityCodeList.Add(m.Value);
                }
            }
            this.cityCodeList = cityCodeList;
        }
예제 #8
0
        /// <summary>
        /// Return a list of all options available in the left pane menu
        /// </summary>
        /// <returns>
        /// Return the list of all available options on the left side bar menu
        /// </returns>
        public List <MenuOption> GetAllMenuOptions()
        {
            string section = "";

            listMenuOptions = new List <MenuOption>();

            IWebElement mainSideBar = CTX.driver.FindElement(By.XPath(".//div[@class='" + sideBarClass + "']"));
            ReadOnlyCollection <IWebElement> listMenuOptionsWe =
                mainSideBar.FindElements(By.XPath(".//span[@class='sidebar-mini-hidden']"));

            foreach (var elem in listMenuOptionsWe)
            {
                IWebElement weParent = WebElementHelper.SafeFindElement(elem, By.XPath(".."));
                // Assumes that a span with an A parent is a header
                if (weParent.GetAttribute("tagName").ToUpper() == "A")
                {
                    listMenuOptions.Add(new MenuOption(elem.Text, section, elem));
                }
                else
                {
                    section = elem.Text;
                }
            }
            return(listMenuOptions);
        }
예제 #9
0
        public HomePage Submit()
        {
            _submitButton.Click();
            if (WebElementHelper.HasElement(_driver, By.Id(EMAIL_EMPTY), TimeSpan.FromMilliseconds(50)))
            {
                throw new MessageException("Email is empty");
            }

            if (WebElementHelper.HasElement(_driver, By.Id(EMAIL_INCORRECT), TimeSpan.FromMilliseconds(50)))
            {
                throw new MessageException("Email is incorrect");
            }

            if (WebElementHelper.HasElement(_driver, By.Id(USER_NOT_FOUND), TimeSpan.FromMilliseconds(50)))
            {
                throw new MessageException("User not created");
            }

            if (WebElementHelper.HasElement(_driver, By.Id(PASSWORD_EMPTY), TimeSpan.FromMilliseconds(50)))
            {
                throw new MessageException("Password is empty");
            }

            if (WebElementHelper.HasElement(_driver, By.Id(PASSWORD_INCORRECT), TimeSpan.FromMilliseconds(50)))
            {
                throw new MessageException("Password is incorrect");
            }

            if (WebElementHelper.HasElement(_driver, By.Id(HOME_PAGE_NICKNAME), TimeSpan.FromSeconds(1)))
            {
                return(new HomePage(_driver));
            }

            return(null);
        }
 public void ClickAddBankAccountButton()
 {
     WebElementHelper.WaitUntilElementClickable(_webDriver,
                                                _addBankAccountButtonByXPath);
     WebElementHelper.ClickAndWaitForPageToLoad(_webDriver,
                                                _addBankAccountButtonByXPath);
 }
예제 #11
0
        public void FillNewUserForm(string firstName, string lastName, string company, string jobtitle,
                                    string industry, string country, string password, string passwordConfirm)
        {
            this.FillEditField(by_firstName, firstName);
            this.FillEditField(by_lastName, lastName);
            this.FillEditField(by_company, company);
            this.FillEditField(by_jobTitle, jobtitle);
            // Fill the passwords fields
            this.FillEditField(by_password, password, false);
            this.FillEditField(by_passwordConfirm, password, false);
            WebElementHelper.ChooseSelectItem(CTX.driver.FindElement(by_industry), dictIndustry[industry]);
            WebElementHelper.ChooseSelectItem(CTX.driver.FindElement(by_country), dictCountries[country]);


            By          by_temp = By.XPath("//input[@id='terms']/..");
            IWebElement chkbox  = CTX.driver.FindElement(by_temp);

            String szAtt = chkbox.GetAttribute("Tag");

            CTX.driver.FindElement(By.XPath("//*[@id='terms']/ancestor::label")).Click();

            CTX.driver.FindElement(by_btnSignUp).Click();

            Console.Out.WriteLine("END");
//            CTX.driver.FindElement(by_btnSignUp).Click();
        }
예제 #12
0
 public MainPage SignIn(BasePage bp, string username, string password)
 {
     WebElementHelper.WaitAndClick(Driver, By.XPath(signInButtonXPath));
     WebElementHelper.WaitAndSendKeys(Driver, By.XPath(userNameXpath), username);
     WebElementHelper.WaitAndSendKeys(Driver, By.XPath(userPassLocator), password);
     WebElementHelper.WaitAndClick(Driver, By.XPath(loginInButtonXpath));
     return(new MainPage(bp));
 }
예제 #13
0
 public WaitingPage BookThisFlight(BasePage bp)
 {
     Thread.Sleep(2000);
     WebElementHelper.WaitAndClick(Driver, By.XPath(flexWindowXPath));
     WebElementHelper.WaitAndSendKeys(Driver, By.XPath(cvvXPath), cvv);
     WebElementHelper.WaitAndClick(Driver, By.XPath(bookThisFlightButtonXPath));
     return(new WaitingPage(bp));
 }
예제 #14
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="element">the web element (div) containing the single provider search result</param>
 public ProviderSearchResult(IWebElement element)
 {
     this.element = element;
     if (element == null)
     {
         throw new NullReferenceException();
     }
     this.helper = new WebElementHelper(element);
 }
예제 #15
0
 public RegisterPage ToRegister()
 {
     _registerButton.Click();
     if (WebElementHelper.HasElement(_driver, By.Id(REGISTER_PAGE), TimeSpan.FromSeconds(1)))
     {
         return(new RegisterPage(_driver));
     }
     return(null);
 }
예제 #16
0
 public MainPage LogiIn(IWebDriver driver)
 {
     driver.Navigate().GoToUrl(baseUrl);
     WebElementHelper.WaitAndClick(driver, By.XPath(singInLinkXPath));
     WebElementHelper.WaitAndSendKeys(driver, By.XPath(loginInputXPath), login);
     WebElementHelper.WaitAndSendKeys(driver, By.XPath(passInputXPath), pass);
     WebElementHelper.WaitAndClick(driver, By.XPath(singInButtonXPath));
     return(new MainPage(driver));
 }
예제 #17
0
        public LoginPage ToLogin()
        {
            _exitButton.Click();
            if (WebElementHelper.HasElement(_driver, By.Id(LOGIN_PAGE_REGISTER), TimeSpan.FromSeconds(2)))
            {
                return(new LoginPage(_driver));
            }

            return(null);
        }
예제 #18
0
 public BookingFirstStepPage SelectFlight(BasePage bp)
 {
     bp.Refresh();
     WebElementHelper.WaitAndClick(Driver, By.XPath(depAirportXPath));
     WebElementHelper.WaitAndClick(Driver, By.XPath(depXPath));
     WebElementHelper.WaitAndClick(Driver, By.XPath(desAirportXPath));
     WebElementHelper.WaitAndClick(Driver, By.XPath(desXPath));
     WebElementHelper.WaitAndClick(Driver, By.XPath(findFlightsXPath));
     return(new BookingFirstStepPage(bp));
 }
예제 #19
0
        public HomePage ToHome()
        {
            _exitInput.Click();

            if (WebElementHelper.HasElement(_driver, By.Id(HOME_PAGE_NICKNAME), TimeSpan.FromSeconds(1)))
            {
                return(new HomePage(_driver));
            }

            return(null);
        }
예제 #20
0
        /// <summary>
        /// Retrieve the web element of a specific element from the new user row in the user table and scroll the view
        /// to that element
        /// </summary>
        /// <param name="column">entry in the TABLE_COLUMN enum that point to the expected column index</param>
        /// <returns></returns>
        private IWebElement _GetNewUserCellRoot(TABLE_COLUMN column, bool bScrollToElem = true)
        {
            ReadOnlyCollection <IWebElement> listCells = _GetNewUserRowRoot().FindElements(By.XPath("./td"));
            IWebElement weCell = listCells[(int)column];

            if (bScrollToElem)
            {
                WebElementHelper.ScrollToElement(weCell);
            }
            return(weCell);
        }
예제 #21
0
        public WaitingPage BookThisFlight(BasePage bp)
        {
            //there is popup window on page, i can not disable it or change driver focus to web page from popup window

            Thread.Sleep(2000);
            WebElementHelper.WaitAndClick(Driver, By.XPath(flexWindowXPath));
            Thread.Sleep(2000);
            WebElementHelper.WaitAndSendKeys(Driver, By.XPath(cvvXPath), cvv);
            Thread.Sleep(2000);
            WebElementHelper.WaitAndClick(Driver, By.XPath(bookThisFlightButtonXPath));
            return(new WaitingPage(bp));
        }
예제 #22
0
        public SettingsPage ToSettings()
        {
            _userNameInput.Click();
            _settingsInput.Click();

            if (WebElementHelper.HasElement(_driver, By.ClassName(SETTINGS_PAGE_AVATAR_CLASS), TimeSpan.FromSeconds(2)))
            {
                return(new SettingsPage(_driver));
            }

            return(null);
        }
예제 #23
0
        /// <summary>
        /// This method sets the email as HubUser and validates the email is not generating an 'Invalid email address'
        /// warning
        ///
        /// </summary>
        /// <param name="email">The email to be used as new user identifier</param>
        private void _SetNewUserEmail(string email)
        {
            IWebElement emailSection = _GetNewUserCellRoot(TABLE_COLUMN.HubUser);
            IWebElement emailInput   = emailSection.FindElement(By.XPath(".//input[@data-testid='validEmailCell']"));

            emailInput.SendKeys(email);
            _GetNewUserCellRoot(TABLE_COLUMN.FirstName, false).Click();


            // Assert the inserted email did not cause issues
            Assert.Null(WebElementHelper.SafeFindElement(emailSection,
                                                         By.XPath(".//span[@data-testid='warningLabel']")));
        }
예제 #24
0
 public PaymentStepPage NextStep(BasePage bp)
 {
     WebElementHelper.MoveToElementAndClick(Driver, By.XPath(seatsCheckBoxXPath));
     Thread.Sleep(1000);
     WebElementHelper.MoveToElementAndClick(Driver, By.XPath(bagsCheckBoxXPath));
     Thread.Sleep(1000);
     WebElementHelper.MoveToElementAndClick(Driver, By.XPath(flexCheckBoxXPath));
     //Thread.Sleep(1000);
     WebElementHelper.MoveToElementAndClick(Driver, By.XPath(insuranceCheckBoxXPath));
     WebElementHelper.MoveToElementAndClick(Driver, By.XPath(checkInCheckBoxXPath));
     WebElementHelper.MoveToElementAndClick(Driver, By.XPath(nextStepButtonXPath));
     return(new PaymentStepPage(bp));
 }
예제 #25
0
        public void SelectBankName(string bankName)
        {
            By elementLocator;

            // TODO support other banks
            switch (bankName)
            {
            case "ANZ(NZ)": elementLocator = _anzDropdownByXPath;
                break;

            default: throw new NotSupportedException("not supported bank: <null>");
            }

            WebElementHelper.WaitUntilElementClickable(_webDriver, elementLocator);
            WebElementHelper.ClickAndWaitForPageToLoad(_webDriver, elementLocator);
        }
예제 #26
0
        public string CheckCityList(DestinationCityPage page)
        {
            StringBuilder sb = new StringBuilder();

            foreach (string str in page.cityCodeList)
            {
                string cityOnMapXPath = mapItemXPath.Replace("***", str);
                if (WebElementHelper.WaitUntilElementEnable(Driver, By.XPath(cityOnMapXPath)) == null)
                {
                    Message = string.Format("city {0} does not found", str);
                    sb.Append(Message);
                }
            }
            this.Message = Message;
            return(Message);
        }
예제 #27
0
        public PaymentStepPage NextStep(BasePage bp)
        {
            //page automatically scrols. i found solution to disable js on page, but it does not work

            WebElementHelper.MoveToElementAndClick(Driver, By.XPath(seatsCheckBoxXPath));
            Thread.Sleep(1000);
            WebElementHelper.MoveToElementAndClick(Driver, By.XPath(bagsCheckBoxXPath));
            Thread.Sleep(1000);
            WebElementHelper.MoveToElementAndClick(Driver, By.XPath(flexCheckBoxXPath));
            //Thread.Sleep(1000);
            WebElementHelper.MoveToElementAndClick(Driver, By.XPath(insuranceCheckBoxXPath));
            //Thread.Sleep(1000);
            WebElementHelper.MoveToElementAndClick(Driver, By.XPath(checkInCheckBoxXPath));
            //Thread.Sleep(1000);
            WebElementHelper.MoveToElementAndClick(Driver, By.XPath(nextStepButtonXPath));
            return(new PaymentStepPage(bp));
        }
예제 #28
0
        public HomePage Submit()
        {
            _submitButton.Click();
            if (WebElementHelper.HasElement(_driver, By.Id(LOGIN_EMPTY), TimeSpan.FromMilliseconds(50)))
            {
                throw new MessageException("Login is empty");
            }

            if (WebElementHelper.HasElement(_driver, By.Id(LOGIN_LESS_CHARACTER), TimeSpan.FromMilliseconds(50)))
            {
                throw new MessageException("Login is small");
            }

            if (WebElementHelper.HasElement(_driver, By.Id(EMAIL_EMPTY), TimeSpan.FromMilliseconds(50)))
            {
                throw new MessageException("Email is empty");
            }

            if (WebElementHelper.HasElement(_driver, By.Id(EMAIL_INCORRECT), TimeSpan.FromMilliseconds(50)))
            {
                throw new MessageException("Email is incorrect");
            }

            if (WebElementHelper.HasElement(_driver, By.Id(USER_EXIST), TimeSpan.FromMilliseconds(50)))
            {
                throw new MessageException("User exist");
            }

            if (WebElementHelper.HasElement(_driver, By.Id(PASSWORD_LESS_CHARACTER), TimeSpan.FromMilliseconds(50)))
            {
                throw new MessageException("Password is small");
            }

            if (WebElementHelper.HasElement(_driver, By.Id(GENDER_EMPTY), TimeSpan.FromMilliseconds(50)))
            {
                throw new MessageException("Gender is empty");
            }

            if (WebElementHelper.HasElement(_driver, By.Id(HOME_PAGE_NICKNAME), TimeSpan.FromSeconds(1)))
            {
                return(new HomePage(_driver));
            }

            return(null);
        }
        // Click on add travelers info some time it gets link or some itime it gets field to add travelers

        public void ClickonTravelersInfo()
        {
            // Added both condition in if else
            try
            {
                if (WebElementHelper.IsElementDisplayed(TravelersLink))
                {
                    ClickButton(TravelersLink);
                }
                else
                {
                    ClickButton(TravelersLink);
                }
            }
            catch (Exception)
            {
                ClickButton(Travelersbtn);
            }
        }
예제 #30
0
        /// <summary>
        /// Click the button to process the creation of the new user or dismiss changes
        ///
        /// </summary>
        /// <param name="bAdd">true to create the new user from the information already field or false to
        /// dismiss the creation and delete the new user line entry</param>
        /// <param name="btnCell"></param>
        /// <param name="bLeftButtons">choose to click the accept/cancel from the left column of the table
        /// or false to use the button from the last colum on the right side</param>
        private void _ClickAddOrCancel(bool bAdd, IWebElement btnCell, bool bLeftButtons = true)
        {
            ReadOnlyCollection <IWebElement> listBtn = btnCell.FindElements(By.XPath(".//button"));

            WebElementHelper.HighlightElement(btnCell);

            if (bAdd)
            {
                IWebElement btn = listBtn[0];
                Assert.IsTrue(listBtn[0].Enabled, "UserCreation: Accept user creation button disabled");
                btn.Click();
            }
            else
            {
                IWebElement btn = listBtn[1];
                Assert.IsTrue(listBtn[1].Enabled, "UserRemoval: Delete user button disabled");
                btn.Click();
            }
        }