示例#1
0
        public static void WaitForPageLoad()
        {
            var javaScriptExecutor = Driver as IJavaScriptExecutor;
            Func <IWebDriver, bool> readyCondition = webDriver => javaScriptExecutor.ExecuteScript("return document.readyState").Equals("complete");

            DriverWait.Until(readyCondition);
        }
示例#2
0
        public void OpenLoginPage()
        {
            var txt = LoginLink.Text;

            DriverWait.Until(ExpectedConditions.TextToBePresentInElement(LoginLink, "Log"));
            LoginLink.Click();
        }
        public void UserRegistration(string firstName, string lastName, string email, string password, string gender,
                                     string country)
        {
            email = email.Replace("_random", Guid.NewGuid().ToString());
            FirstNameTextBox.SendKeys(firstName);
            LastNameTextBox.SendKeys(lastName);
            EmailTextBox.SendKeys(email);
            PasswordTextBox.SendKeys(password);
            foreach (var genderBtn in GenderRadioButton)
            {
                var genderValue = genderBtn.GetAttribute("value");
                if (genderValue == gender)
                {
                    genderBtn.Click();
                    break;
                }
            }

            var countrySelect = new SelectElement(CountrySelectBox);

            countrySelect.SelectByText(country);


            DriverWait.Until(ExpectedConditions.ElementToBeClickable(SignupButton)).SendKeys(Keys.Enter);
        }
示例#4
0
        public static void AcceptAlert()
        {
            DriverWait.Until(ExpectedConditions.AlertIsPresent());
            IAlert alert = Driver.SwitchTo().Alert();

            Logger.LogMsg(Severity.WARN, string.Format("There is an alert with text >>> {0}", alert.Text));
            alert.Accept();
        }
 /// <summary>
 ///     Login in Souq.com using Facebook Account
 /// </summary>
 /// <param name="email"> Facebook email address or telephone number</param>
 /// <param name="password">Facebook password</param>
 public void LoginUsingFacebook(string email, string password)
 {
     FacebookButton.Click();
     DriverWait.Until(ExpectedConditions.UrlContains("facebook.com"));
     FacebookEmailTextBox.SendKeys(email);
     FacebookPasswordTextBox.SendKeys(password);
     FacebookLoginButton.Click();
 }
示例#6
0
        public void SendRecoverEmail(string email)
        {
            EmailTextBox.SendKeys(email);
            SubmitButton.Click();
            DriverWait.Until(ExpectedConditions.TextToBePresentInElement(FlashAlert,
                                                                         "An email was sent to you to reset your password."));

            Thread.Sleep(10000);
        }
示例#7
0
        public void ConvertKilowattHoursToNewtonMeters(double kWh, Format format = Format.Decimal)
        {
            CelsiusInput.SendKeys(kWh.ToString());
            if (format != Format.Decimal)
            {
                var formatText = Enum.GetName(typeof(Format), format);
                new SelectElement(FormatField).SelectByText(formatText);
            }

            DriverWait.Until(drv => Answer != null);
        }
示例#8
0
 public static IWebElement WaitUntilElementIsVisible(By findElementBy)
 {
     try
     {
         return(DriverWait.Until(ExpectedConditions.ElementIsVisible(findElementBy)));
     }
     catch (UnhandledAlertException)
     {
         AcceptAlert();
         return(null);
     }
 }
示例#9
0
 public static IWebElement WaitUntilElementIsClickable(IWebElement element)
 {
     try
     {
         return(DriverWait.Until(ExpectedConditions.ElementToBeClickable(element)));
     }
     catch (UnhandledAlertException)
     {
         AcceptAlert();
         return(null);
     }
 }
        /// <summary>
        ///     Login in Souq.com using Amazon Account
        /// </summary>
        /// <param name="email"> Amazin email address </param>
        /// <param name="password">Amazon password</param>
        public void LoginUsingAmazon(string email, string password)
        {
            // Switching to amazon login popup window
            AmazonButton.Click();
            Driver.SwitchTo().Window(Driver.WindowHandles.ToList().Last());
            DriverWait.Until(ExpectedConditions.UrlContains("amazon.com"));

            // Entering Amazon User Credentials
            AmazonEmailTextBox.SendKeys(email);
            AmazonPasswordTextBox.SendKeys(password);
            AmazonLoginButton.Click();

            // returning back to Souq.com Login Page
            Driver.SwitchTo().Window(Driver.WindowHandles.ToList().First());
        }
        public void Login(string username, string password)
        {
            DriverWait.Until(ExpectedConditions.ElementToBeClickable(EmailTextBox)).Click();

            EmailTextBox.SendKeys(Keys.Enter);
            EmailTextBox.SendKeys(username);
            EmailTextBox.SendKeys(Keys.Enter);

            DriverWait.Until(ExpectedConditions.ElementToBeClickable(PasswordTextBox)).SendKeys(password);
            PasswordTextBox.SendKeys(Keys.Enter);
            DriverWait.Until(ExpectedConditions.UrlContains("https://mail.google.com/mail/u/0/#inbox"));
            var emails = Driver.FindElements(By.ClassName("bog"));

            foreach (var email in emails)
            {
                if (email.Text.Contains("Souq.com"))
                {
                    email.Click();
                }
            }
            //  action.MoveToElement(email).Click().Perform();

            ClickEmail("Souq.com Password Reset");
        }
示例#12
0
 public void ConvertKilowattHoursToNewtonMeters(double kWh)
 {
     CelsiusInput.SendKeys(kWh.ToString());
     DriverWait.Until(drv => Answer != null);
 }
 public bool TableDisplayed()
 {
     return(DriverWait.Until(drv => employees_table.Displayed));
 }
示例#14
0
 public bool ValidatePage()
 {
     return(DriverWait.Until(drv => employees_menu.Displayed));
 }
示例#15
0
 public static bool WaitUntilElementIsDisappeared(IWebElement element)
 {
     return(DriverWait.Until(ExpectedConditions.StalenessOf(element)));
 }
示例#16
0
 public static bool WaitUntilInvisibilityOfElementLocated(By findElementBy)
 {
     return(DriverWait.Until(ExpectedConditions.InvisibilityOfElementLocated(findElementBy)));
 }
示例#17
0
 public static IList <IWebElement> WaitUntilAllElementsAreVisible(By findElementBy)
 {
     return(DriverWait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(findElementBy)));
 }
示例#18
0
 public static IWebElement WaitUntilElementExists(By findElementBy)
 {
     return(DriverWait.Until(ExpectedConditions.ElementExists(findElementBy)));
 }
 public void ConvertSecondsToMintes(double seconds)
 {
     SecondsInput.SendKeys(seconds.ToString());
     DriverWait.Until(drv => Answer != null);
 }
示例#20
0
 public static IWebDriver WaitUntilFrameToBeAvailableAndSwitchToIt(string frameName)
 {
     return(DriverWait.Until(ExpectedConditions.FrameToBeAvailableAndSwitchToIt(frameName)));
 }