Ejemplo n.º 1
0
        public void PerformActions(string keyword, string locatorType, string locatorValue, params string[] parameters)
        {
            switch (keyword)
            {
            case "Click":
                ButtonHelper.ClickOnButton(GetElementLocator(locatorType, locatorValue));
                break;

            case "SendKeys":
            {
                TextBoxHelper.ClearTextbox(GetElementLocator(locatorType, locatorValue));
                TextBoxHelper.TypeInTextbox(GetElementLocator(locatorType, locatorValue), parameters[0]);
            }
            break;

            case "Navigate":
                NavigationHelper.NavigationToURL(parameters[0]);
                break;

            case "Select":
                DropdownListHelper.SelectElement(GetElementLocator(locatorType, locatorValue), parameters[0]);
                break;

            case "WaitForEle":
                GenericHelpers.WaitForElementInPage(GetElementLocator(locatorType, locatorValue),
                                                    TimeSpan.FromSeconds(60));
                break;

            default:
                throw new NoSuchKeywordException("No such keyword found" + keyword);
            }
        }
        public void TestDefaultWait()
        {
            NavigationHelper.NavigationToURL(ObjectRepository.Config.GetWebsite());
            LinkHelper.ClickLink(By.LinkText("File a Bug"));

            TextBoxHelper.ClearTextbox(By.Id("Bugzilla_login"));
            TextBoxHelper.TypeInTextbox(By.Id("Bugzilla_login"), ObjectRepository.Config.GetUsername());

            TextBoxHelper.ClearTextbox(By.Id("Bugzilla_password"));
            TextBoxHelper.TypeInTextbox(By.Id("Bugzilla_password"), ObjectRepository.Config.GetPassword());

            ButtonHelper.ClickOnButton(By.Id("log_in"));

            ObjectRepository.Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1);

            GenericHelpers.WaitForElement(By.Id("bug_severity"), TimeSpan.FromSeconds(50));
            IWebElement   ele    = GenericHelpers.WaitForElementInPage(By.Id("bug_severity"), TimeSpan.FromSeconds(50));
            SelectElement select = new SelectElement(ele);

            select.SelectByText("major");

            //DefaultWait<IWebElement> wait = new DefaultWait<IWebElement>(ObjectRepository.Driver.FindElement(By.Id("bug_severity")));
            //wait.PollingInterval = TimeSpan.FromMilliseconds(200);
            //wait.Timeout = TimeSpan.FromSeconds(50);
            //wait.IgnoreExceptionTypes(typeof(NoSuchElementException), typeof(ElementNotVisibleException));
            //Console.WriteLine($"After wait: {wait.Until(WaitForValueChange())}");
        }
Ejemplo n.º 3
0
 public void Logout()
 {
     if (GenericHelpers.IsElenmentPresent(By.XPath("//div[@id='header']/descendant::li[position()=11]/a")))
     {
         ButtonHelper.ClickOnButton(By.XPath("//div[@id='header']/descendant::li[position()=11]/a"));
     }
     GenericHelpers.WaitForElementInPage(By.Id("welcome"), TimeSpan.FromSeconds(30));
 }
Ejemplo n.º 4
0
 public void SubmitBug()
 {
     submitButton.Click();
     GenericHelpers.WaitForElementInPage(By.Id("bugzilla-body"), TimeSpan.FromSeconds(30));
 }
Ejemplo n.º 5
0
 public void AttachmentClick()
 {
     AddAnAttachmentButton.Click();
     GenericHelpers.WaitForElementInPage(By.Id("data"), TimeSpan.FromSeconds(30));
 }