Пример #1
0
        public void CompleteUserForm(string title, string initial, string firstName, string middleName, string lastName, string gender,
                                     string language, string country)
        {
            // sets the window count
            OpenWindows = _driver.WindowHandles;

            if (OpenWindows.Count < 2)
            {
                _driverHelpers.PerformSelectFromDropDownByText(Title, title);
                _driverHelpers.PerformKeyboardTypingOperation(Initial, initial);
                _driverHelpers.PerformKeyboardTypingOperation(FirstName, firstName);
                _driverHelpers.PerformKeyboardTypingOperation(MiddleName, middleName);
                Gender.Select(x => x.FindElement(By.CssSelector("input[name*='" + gender + "']"))).ToList().ForEach(x => x.Click());
                LanguagesKnown.Select(x => x.FindElement(By.CssSelector("input[name*='" + language + "']"))).ToList().ForEach(x => x.Click());
            }
            else
            {
                // switches to popup window
                _driver.SwitchTo().Window(OpenWindows[1]);

                _driverHelpers.PerformSelectFromDropDownByText(Title, title);
                _driverHelpers.PerformKeyboardTypingOperation(Initial, initial);
                _driverHelpers.PerformKeyboardTypingOperation(FirstName, firstName);
                _driverHelpers.PerformKeyboardTypingOperation(MiddleName, middleName);
                _driverHelpers.PerformKeyboardTypingOperation(LastName, lastName);
                Gender.Select(x => x.FindElement(By.CssSelector("input[name*='" + gender + "']"))).ToList().ForEach(x => x.Click());
                _driverHelpers.PerformSelectFromDropDownByText(CountryDropDown, country);
                _driverHelpers.PerformClickOperation(SaveBtn);

                // Closses the pop up windown
                _driver.Close();
                // resets the windown count variable
                OpenWindows = _driver.WindowHandles;

                // switches back to parent window
                if (OpenWindows.Count == 1)
                {
                    _driver.SwitchTo().Window(OpenWindows[0]);
                }
                else
                {
                    throw new Exception("Parent window not found");
                }
            }
        }
Пример #2
0
        public UserFormEaPage Login()
        {
            _driverHelpers.PerformClickOperation(LoginBtn);

            return(new UserFormEaPage(_driver, _scenarioContext, _driverHelpers));
        }