private string BuildTextNotFoundExceptionText(string textToFind, BaseTestDriver ext)
        {
            StringBuilder sb = new StringBuilder();

            string customLoggingMessage =
                String.Format("#### The text:  {0} ####\n ####WAS NOT FOUND!####", textToFind);
            sb.AppendLine(customLoggingMessage);

            string cuurentUrlMessage = String.Format("The URL when the test failed was: {0}", ext.Browser.Url);
            sb.AppendLine(cuurentUrlMessage);

            return sb.ToString();
        }
Exemplo n.º 2
0
        public void LoginWithDefaultUser(BaseTestDriver driver, IWebDriver browser, string name = "Ninja", string pass = "******")
        {
            PageFactory.InitElements(browser, this);

            this.Username.Clear();
            this.Username.SendKeys(name);

            this.Password.Clear();
            this.Password.SendKeys(pass);

            this.LoginButton.Click();
            driver.Wait();
        }
        private string BuildStillCheckedExceptionText(By by, BaseTestDriver ext)
        {
            StringBuilder sb = new StringBuilder();

            string customLoggingMessage =
                String.Format("#### The element with the location strategy:  {0} ####\n ####WAS CHECKED!####",
                    by.ToString());
            sb.AppendLine(customLoggingMessage);

            string cuurentUrlMessage = String.Format("The URL when the test failed was: {0}", ext.Browser.Url);
            sb.AppendLine(cuurentUrlMessage);

            return sb.ToString();
        }
        public StillCheckedException(By by, BaseTestDriver ext)
        {
            string message = this.BuildStillCheckedExceptionText(by, ext);

            throw new ApplicationException(message);
        }
        public NotCheckedException(By by, BaseTestDriver ext, Exception ex)
        {
            string message = this.BuildNotCheckedExceptionText(by, ext);

            throw new ApplicationException(message, ex);
        }
        public TextNotFoundException(string textToFind, BaseTestDriver ext)
        {
            string message = this.BuildTextNotFoundExceptionText(textToFind, ext);

            throw new ApplicationException(message);
        }
        public ElementStillVisibleException(By by, BaseTestDriver ext)
        {
            string message = this.BuildElementStillVisibleExceptionText(by, ext);

            throw new ApplicationException(message);
        }
Exemplo n.º 8
0
 public void Login(BaseTestDriver driver, IWebDriver browser)
 {
     PageFactory.InitElements(browser, this);
     this.LoginButton.Click();
     driver.Wait();
 }
        public NoSuchElementException(By by, BaseTestDriver ext)
        {
            string message = this.BuildNotFoundElementExceptionText(by, ext);

            throw new ApplicationException(message);
        }