Example #1
2
        public void ShouldMoveAvatar()
        {
            IWebDriver driver = Tools.CreateDriver();
            try
            {
                driver.Navigate().GoToUrl(
                    "http://localhost/projects/test-client/client.xhtml#FIVESTesting&OverrideServerPort=34837");
                Tools.Login(driver, "1", "");

                WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
                IJavaScriptExecutor jsExecutor = driver as IJavaScriptExecutor;

                // Wait for the FIVES.AvatarEntityGuid to become available.
                string avatarGuid = (string)wait.Until(d => jsExecutor.ExecuteScript("return FIVES.AvatarEntityGuid"));

                // Wait until avatar's transform element becomes available.
                IWebElement avatarTransform = wait.Until(d => d.FindElement(By.Id("transform-" + avatarGuid)));

                string startTranslation = avatarTransform.GetAttribute("translation");

                jsExecutor.ExecuteScript("$(document).trigger({type: 'keydown', which: 87, keyCode: 87})");

                // Wait until avatar starts to move.
                wait.Until(d => avatarTransform.GetAttribute("translation") != startTranslation);
            }
            finally
            {
                driver.Quit();
            }
        }
 public void SetPageFilterList(string value)
 {
     WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(waitsec));
     wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("#crmGrid_SavedNewQuerySelector>span"))).Click();
     IWebElement parent = wait.Until(ExpectedConditions.ElementIsVisible(By.Id("Dialog_0")));
     parent.FindElement(By.XPath("//li[a[contains(@title,'"+value+"')]]")).Click();
 }
        public GoogleSearch(IWebDriver driver, string p1, string p2)
        {
            try
            {
                driver.Navigate().GoToUrl("http://www.google.pt");

                driver.FindElement(By.Name("q")).SendKeys(p1);
                Logger.Out("Driver title before send keys enter =" + driver.Title);
                //get the suggestions box from google
                Logger.Out(DateTime.Now.ToString());
                WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(5));
                 wait.Until((d) => { return d.FindElement(By.ClassName("gssb_e")).Displayed; });
                IWebElement resultsDiv = driver.FindElement(By.ClassName("gssb_e"));
                Logger.Out(DateTime.Now.ToString());
                //// If results have been returned, the results are displayed in a drop down.
                if (resultsDiv.Displayed)
                {
                    Logger.Out("Suggestions appeared");
                }
                else
                    throw new Exception("No suggestions");
                driver.FindElement(By.Name("q")).SendKeys(Keys.Enter);
                Logger.Out("before wait"+driver.Title);
                wait.Until((d) => { return d.Title.StartsWith("banana"); });
                //Check that the Title is what we are expecting
                Assert.AreEqual(p1+" - Pesquisa do Google", driver.Title);
                Logger.Out("after wait & assert- "+driver.Title);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public static bool GoToCard()
 {
     var wait = new WebDriverWait(Drivers.Driver, TimeSpan.FromSeconds(40));
     wait.Until(ExpectedConditions.ElementIsVisible(By.Id("headerShoppingCart"))).Click();
     bool goods = wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(".row.rounded.productLists"))).Displayed;
     return goods;
 }
 public static bool OpenPayPal()
     {
         var wait = new WebDriverWait(Drivers.Driver, TimeSpan.FromSeconds(5));
         wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("a[class='btn btn-warning ex en']"))).Click();
         bool openpaypal = wait.Until(ExpectedConditions.ElementIsVisible(By.Id("billingBox"))).Displayed;
         return openpaypal;
      }
 public static void GoTo()
 {
     Drivers.Driver.Navigate().GoToUrl(Drivers.BaseAddress);
     var wait = new WebDriverWait(Drivers.Driver, TimeSpan.FromSeconds(5));
     wait.Until(ExpectedConditions.ElementIsVisible(By.LinkText("Sign In"))).Click();
     wait.Until(ExpectedConditions.ElementIsVisible(By.Id("login-form")));
 }
        public void AddProject()
        {
            BaseTest.BaseUrl = BugTrackerPage.HomePageUrl;
            BaseTest.Setup(BaseTest.BaseUrl);

            WebDriverWait wait = new WebDriverWait(BaseTest.BaseDriver, TimeSpan.FromSeconds(5));
            wait.Until((d) => { return d.Title.StartsWith("BugTracker"); });

            BugTrackerPage.AreAllElementShown();

            Assert.AreEqual("BugTracker.NET - bugs", BaseTest.BaseDriver.Title);
            // add new bug
            BugTrackerPage.AddNewBugBtn.Click();

            wait.Until((d) => { return d.Title.StartsWith("BugTracker.NET - Create Bug"); });

            try
            {
                Assert.AreEqual("Project:", BugTrackerPage.ProjectTextLabel.Text);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }

            Assert.IsTrue(BugTrackerPage.ProjectSelect.Displayed);
            var select = new SelectElement(BugTrackerPage.ProjectSelect);
            select.SelectByText("HasCustomFieldsProject");
            //BaseTest.BaseDriver.FindElement(By.XPath("//option[@value='3']")).Click();
            Assert.AreEqual("Project-specific", BugTrackerPage.ProjectSpecificLabel.Text);
            Assert.IsTrue(BugTrackerPage.ProjectSpecificSelect.Displayed);

            BaseTest.TearDown();
        }
Example #8
0
        static void Main(string[] args)
        {
            IWebDriver driver = new FirefoxDriver();

            driver.Navigate().GoToUrl(@"http://www.weibo.com");

            WebDriverWait waitPageOpen = new WebDriverWait(driver, TimeSpan.FromSeconds(60));
            IWebElement inpt_username = waitPageOpen.Until<IWebElement>((d) => { return d.FindElement(By.Name("username")); });
            waitPageOpen.Until((d) => { return inpt_username.Displayed; });
            inpt_username.SendKeys(@"*****@*****.**");

            IWebElement inpt_pwd = driver.FindElement(By.Name("password"));
            inpt_pwd.SendKeys(@"kodakpdc2000");

            IWebElement btn_login = driver.FindElement(By.ClassName("W_btn_g"));
            btn_login.Click();

            waitPageOpen.Until((d)=>{return d.Title.StartsWith("我的首页");});

            //IList<IWebElement> personInfos = driver.FindElements(By.ClassName("user_atten"));
            //if (personInfos.Count == 1)
            //{ personInfos[0].FindElement(By.PartialLinkText("粉丝")).Click(); }

            IWebElement temp = driver.FindElement(By.PartialLinkText("粉丝"));
            temp.Click();

            Console.Read();
        }
        public override void Execute(IWebDriver driver, dynamic context)
        {
            var resolvedSelector = Test.ResolveMacros(Selector);

            var wait = new WebDriverWait(driver, TimeSpan.FromMilliseconds(Timeout == 0 ? 5000 : Timeout));

            try
            {
                if (WaitForVisible)
                {
                    wait.Until(d => ExpectedConditions.ElementIsVisible(By.CssSelector(resolvedSelector))(d));
                }
                else
                {
                    wait.Until(d => d.FindElement(By.CssSelector(resolvedSelector)));
                }
                if (IsFalseExpected)
                    throw new InvalidOperationException("Element with selector '" + Selector + "' exists.");
            }
            catch (WebDriverTimeoutException)
            {
                if (!IsFalseExpected)
                    throw;
            }
        }
Example #10
0
        public void sumi()
        {
            IWebElement element;
            driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));

            // webpegeを表示
            driver.Navigate().GoToUrl("https://www.f-aspit.com/aspit/portal/login.asp");
            driver.FindElement(By.Name("KigyoCD")).SendKeys("99990005");
            driver.FindElement(By.Name("UserID")).SendKeys("goen9995");
            driver.FindElement(By.Name("Password")).SendKeys("354959");
            driver.FindElement(By.CssSelector("img[id='img01']")).Click();

            driver.SwitchTo().Frame("fraNews");
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(5));
            wait.Until(ExpectedConditions.ElementToBeClickable(By.Name("btnMenu0")));
            element = driver.FindElement(By.Name("btnMenu0"));
            element.SendKeys(Keys.Enter);
            wait.Until(ExpectedConditions.InvisibilityOfElementLocated(By.Name("btnMenu0")));
            wait.Until(ExpectedConditions.FrameToBeAvailableAndSwitchToIt("main"));
            element = driver.FindElement(By.LinkText("受注照会"));
            element.SendKeys(Keys.Enter);
            driver.FindElement(By.Name("selFromDay")).Click();
            driver.FindElement(By.XPath("//span[@id='idTargetKikanArea_From_Day']/select//option[1]")).Click();
            driver.FindElement(By.Id("imgDownload")).Click();
            //ここにダウンロード処理を入れる
            driver.Quit();
        }
            /// <summary>
            /// Lookup a reference field value.
            /// </summary>
            /// <param name="driver"></param>
            /// <param name="by">A mechanism by which to find the desired reference field within the current document.</param>
            /// <param name="sendKeys">A property value of the current reference field.</param>
            public static void Lookup(this IWebDriver driver, By by, string sendKeys)
            {
                WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));

                IWebElement lookup = wait.Until(ExpectedConditions.ElementIsVisible(by));
                lookup.Click();

                string currentWindowHandle = driver.CurrentWindowHandle;
                string searchWindow = driver.WindowHandles.First(o => o != currentWindowHandle);
                driver.SwitchTo().Window(searchWindow);

                IWebElement searchFor = wait.Until(ExpectedConditions.ElementExists(By.ClassName("list_search_text")));
                searchFor.Click();
                searchFor.Clear();
                searchFor.SendKeys(sendKeys);

                var selects = driver.FindElements(By.ClassName("list_search_select"));
                IWebElement search = selects.First(o => o.GetAttribute("id").Contains("_select"));
                driver.SelectOption(search, "Name"); //"for text");

                wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("img[title='Go']"))).Click();

                IWebElement item = wait.Until(ExpectedConditions.ElementExists(By.LinkText(sendKeys)));

                item.Click();

                driver.SwitchTo().Window(currentWindowHandle);
                driver.SwitchTo().Frame("gsft_main");
            }
 public static void Myaccount()
 {
     var wait = new WebDriverWait(Drivers.Driver, TimeSpan.FromSeconds(5));
     wait.Until(ExpectedConditions.ElementIsVisible(By.LinkText("My Account"))).Click();
     wait.Until(ExpectedConditions.ElementIsVisible(By.LinkText("Address"))).Click();
     wait.Until(ExpectedConditions.ElementIsVisible(By.LinkText("Add new address"))).Click();
 }
 public static bool PayPal()
 {
     Drivers.Driver.FindElement(By.Id("batchRemove")).Click();
     var wait = new WebDriverWait(Drivers.Driver, TimeSpan.FromSeconds(10));
     wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("a[class='btn btn-warning ex ru']"))).Click();
     bool paypal = wait.Until(ExpectedConditions.ElementIsVisible(By.Id("billingBox"))).Displayed;
     return paypal;
 }
 public static void Quantity()
 {
 //________________________________Выбор кол-ва товара_____________________________
 var wait = new WebDriverWait(Drivers.Driver, TimeSpan.FromSeconds(10));
 wait.Until(ExpectedConditions.ElementIsVisible(By.Id("quantity"))).SendKeys("\b10");
 wait.Until(ExpectedConditions.ElementIsVisible(By.Id("addToCart"))).Click();
     Drivers.Driver.FindElement(By.Id("addToCart")).Click();
 }
 public static bool CreateddAdress_2()
 {
     var wait = new WebDriverWait(Drivers.Driver, TimeSpan.FromSeconds(10));
     wait.Until(ExpectedConditions.ElementIsVisible(By.LinkText("Address"))).Click();
     wait.Until(ExpectedConditions.ElementIsVisible(By.LinkText("Add new address")));
     bool add_2 = wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(".dashboard-list>li"))).Displayed;
     return add_2;
 }
 public void ClickAvailabilityList()
 {
     WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(waitsec));
     IWebElement elem = wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("#FormTitle>h1")));
     string title = elem.GetAttribute("title");
     wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("#rta_availability>div"))).Click();
     wait.Until(ExpectedConditions.ElementIsVisible(By.Id("rta_availability_i"))).GetAttribute("id");
 }
        public static IWebElement FindElementWithWait(this IWebDriver driver, By locator,
            int timeoutMilliseconds = 10000)
        {
            var wait = new WebDriverWait(driver, TimeSpan.FromMilliseconds(timeoutMilliseconds));
            var visibleElement = wait.Until(ExpectedConditions.ElementIsVisible(locator));

            wait.Until(d => !visibleElement.IsElementStale());
            return visibleElement;
        }
 public void SetTenancySearchText(string searchValue)
 {
     WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(waitsec));
     IWebElement element = wait.Until(ExpectedConditions.ElementIsVisible(By.Id("crmGrid_quickFindContainer")));
     element = wait.Until(ExpectedConditions.ElementIsVisible(By.Id("crmGrid_findCriteria")));
     element.Clear();
     element.SendKeys(searchValue.ToString());
     element.SendKeys(Keys.Enter);
 }
 public void ClickActivitiesAddButton()
 {
     WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(waitsec));
     wait.Until(ExpectedConditions.ElementIsVisible(By.Id("FormTitle"))).Click();
     IWebElement elem = wait.Until(ExpectedConditions.ElementIsVisible(By.Id("Subgrid_Activities_addImageButtonImage")));
     Actions action = new Actions(driver);
     action.MoveToElement(elem).ClickAndHold().Build().Perform();
     Thread.Sleep(1000);
     action.MoveToElement(elem).Release().Build().Perform();
 }
 public static bool FindCorrect()
 {
     bool y;
     var wait = new WebDriverWait(Drivers.Driver, TimeSpan.FromSeconds(5));
     bool x01 = wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("div[class='subCates']"))).Displayed;
     bool x02 = wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("div[class='alert prodLists']"))).Displayed;
     if (x01 && x02)y = true;
     else y = false;
     return y;
 }
        public static IWebElement FindElement(this IWebDriver driver, By by, int timeoutInSeconds)
        {
            if (timeoutInSeconds > 0)
            {
                var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(timeoutInSeconds));
                wait.Until(drvr => drvr.FindElement(by));
                wait.Until(drvr => drvr.FindElement(by).Displayed);

            }
            return driver.FindElement(by);
        }
        public void faciltyListCreateTestDemo()
        {
            this.window.Navigate().GoToUrl(this.homenUrl);
            WebDriverWait webDriverWait = new WebDriverWait(this.window, TimeSpan.FromMilliseconds(1000.0));
            IWebElement loginLink = webDriverWait.Until<IWebElement>(ExpectedConditions.ElementIsVisible(By.Id("Facility")));
            loginLink.Click();
            IWebElement Link = webDriverWait.Until<IWebElement>(ExpectedConditions.ElementIsVisible(By.Id("facilityCreate")));
            Link.Click();
            

        }
Example #23
0
        public void login()
        {
            int subTestNo = 1;
            StringBuilder output = new StringBuilder();
            ////     WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
            driver.FindElement(By.Id("signIn")).Click();
            driver.FindElement(By.Id("checkbox_show_password")).Click();
            output.AppendLine("Subtest: " + subTestNo++ + " Login button clicked. Status: Passed");
            Console.WriteLine("Subtest: " + subTestNo++ + " Login button clicked. Status: Passed");
            AppiumWebElement userNameInput = driver.FindElement(By.Id("txt_vpn_id"));
            output.AppendLine("Subtest: " + subTestNo++ + " Navigate to login page and clear SignIn field. Status: Passed");
            Console.WriteLine("Subtest: " + subTestNo++ + " Navigate to login page and clear SignIn field. Status: Passed");
            userNameInput.Clear();
            userNameInput.SendKeys("purevpn0m973650");
            output.AppendLine("Subtest: " + subTestNo++ + " Entered user id 'purevpn0m973650' Status: Passed");
            Console.WriteLine("Subtest: " + subTestNo++ + " Entered user id 'purevpn0m973650' Status: Passed ");
            AppiumWebElement Pwd = driver.FindElement(By.Id("txt_vpn_password"));

            Pwd.Clear(); Pwd.SendKeys("o5jtueb0");
            output.AppendLine("Subtest: " + subTestNo++ + " Entered password 'bfenys31' Status: Passed");
            Console.WriteLine("Subtest: " + subTestNo++ + " Entered password  bfenys31 Status: Passed");
            WebDriverWait wait = new WebDriverWait(driver, new TimeSpan(0, 0, 100));
            //AppiumWebElement alert = driver.FindElement(By.Id("alertTitle"));
            driver.HideKeyboard();
            wait.Until(ExpectedConditions.ElementToBeClickable(By.Id("btn_login")));
            driver.FindElement(By.Id("btn_login")).Click();
            output.AppendLine("Subtest: " + subTestNo++ + " Click on Login button. Status: Passed ");
            Console.WriteLine("Subtest: " + subTestNo++ + " Click on Login button. Status: Passed ");

             //   driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
            wait.Until(ExpectedConditions.ElementExists(By.Id("image_view")));
              output.AppendLine("Subtest: " + subTestNo++ + " Successfully Signed In. Status: Passed ");
              Console.WriteLine("Subtest: " + subTestNo++ + " Successfully Signed In. Status: Passed");
                driver.FindElement(By.Id("image_view")).Click();
                driver.FindElement(By.Id("image_view")).Click();
                driver.FindElement(By.Id("image_view")).Click();

                wait.Until(ExpectedConditions.ElementToBeClickable(By.Id("action_share")));

                driver.FindElement(By.Id("action_share")).Click();
                wait.Until(ExpectedConditions.ElementIsVisible(By.Id("txt_current_location")));
            driver.FindElement(By.Id("actionBtn")).Click();
                driver.FindElement(By.Id("btn_uk")).Click();
              //  driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));
              //  WebDriverWait wait = new WebDriverWait(driver, new TimeSpan(0, 0, 5));

                wait.Until(ExpectedConditions.ElementIsVisible(By.Id("txt_current_location")));
                output.AppendLine("Subtest: " + subTestNo++ + " Netherland connected Successfully. Status: Passed  ");
                Console.WriteLine("Subtest: " + subTestNo++ + " Netherland connected Successfully. Status: Passed ");
                driver.FindElement(By.Id("actionBtn")).Click();
                driver.FindElement(By.Id("btn_vpn_action")).Click();
             //   wait.Until(ExpectedConditions.ElementToBeClickable(By.Id("txt_ip_address")));
                Utils.writeToFile(output.ToString());
        }
Example #24
0
        public void ThenAllowMeToDeleteTheContentAndReturnMeToTHeHomePage()
        {
            UxSession.Driver.FindElement(By.Id("DeleteContent")).SendKeys(Keys.Enter);

            var wait = new WebDriverWait(UxSession.Driver, TimeSpan.FromSeconds(5));
            wait.Until(x => x.Url == WebServer.GetUrl(null));

            //Verify if you try to view the page it goes to the page to create it
            UxSession.Driver.Navigate().GoToUrl(WebServer.GetUrl("/content/for/delete"));
            wait.Until(x => x.Url == WebServer.GetUrl("/Missing", "aspxerrorpath=/content/for/delete"));
        }
Example #25
0
 //Waits for a system configured time in the configuration file
 //if it is not configured it takes a 10 sencond value
 public static void WaitUntilElementFillWithContentUsingXpath(string xpathOfUi)
 {
     WebDriverWait wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(Configuration.WaitForResponse));
     IWebElement myDynamicElement = wait.Until<IWebElement>((d) =>
     {
         return d.FindElement(By.XPath(xpathOfUi));
     });
     bool foundContent = wait.Until<bool>((b) =>
     {
         return myDynamicElement.Text.Length > 0;
     });
 }
Example #26
0
        public void GivenIHaveLoggedInAsAContentAdmin()
        {
            UxSession.Driver.Navigate().GoToUrl(WebServer.GetUrl("/Account/LogOn"));
            var wait = new WebDriverWait(UxSession.Driver, TimeSpan.FromSeconds(10));
            wait.Until(x => x.FindElement(By.Id("UserName")) != null);

            UxSession.Driver.FindElement(By.Id("UserName")).SendKeys("admin");
            UxSession.Driver.FindElement(By.Id("Password")).SendKeys("password");
            UxSession.Driver.FindElement(By.XPath("//input[@value='Log On']")).SendKeys(Keys.Enter);

            wait.Until(x => x.Title == "Home Page");
        }
Example #27
0
		public static void ShouldContainCustomerUsername( RemoteWebDriver driver, AuthenticatingNavigator navigator )
		{
			using ( driver.FinallyQuitGuard() ) // TODO improve this using http://xunit.codeplex.com/workitem/9798 ( WAS: http://xunit.codeplex.com/discussions/362097 )
			{
				navigator.NavigateWithAuthenticate( driver, "" );
                WebDriverWait wait = new WebDriverWait( driver, TimeSpan.FromSeconds( 5 ) );
                var userSettingsMenu = wait.Until( d => driver.FindElementByCssSelector( "button[name='settings']" ) );
                userSettingsMenu.Click();
                var usernameElement = wait.Until( d => driver.FindElementByCssSelector( "li[id='username']" ) );

				Assert.Contains( ConfigurationManager.AppSettings[ "PortalUsername" ], usernameElement.Text );
			}
		}
Example #28
0
        public static IList<IWebElement> GetElements(By by, IWebDriver driver)
        {
            try {
                WebDriverWait wait = new WebDriverWait(driver, new TimeSpan(0, 0, timeout));
                IWebElement element = wait.Until<IWebElement>(ExpectedConditions.ElementExists(by));
                wait.Until(d => (bool)(d as IJavaScriptExecutor).ExecuteScript("return jQuery.active == 0"));

                return driver.FindElements(by);
            }
            catch(Exception) {
                return null;
            }
        }
Example #29
0
        public static void ClearTextBoxValue(string elementId, IWebDriver d)
        {
            WebDriverWait wait = new WebDriverWait(d, TimeSpan.FromSeconds(waitsec));
            IWebElement elem = wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector("#" + elementId + ">div")));
            Actions actions = new Actions(d);
            actions.MoveToElement(elem,0,0).Click().Build().Perform();

            Thread.Sleep(500);
            IWebElement el = wait.Until(ExpectedConditions.ElementIsVisible(By.Id(elementId + "_i")));
            actions.MoveToElement(elem, 0, 0).Click().Build().Perform();
            el.Clear();
            el.SendKeys(Keys.Backspace);
        }
        public void Login_Invalid_Attempt_then_login_valid() 
        {
            string invalidmail="*****@*****.**";
            this.window.Navigate().GoToUrl(this.homenUrl);
            //click login link
            WebDriverWait webDriverWait = new WebDriverWait(this.window, TimeSpan.FromMilliseconds(1000.0));
            IWebElement loginLink = webDriverWait.Until<IWebElement>(ExpectedConditions.ElementIsVisible(By.Id(this.logonlinkId)));
            Assert.IsTrue(this.window.Title.Contains("LMS"));
            loginLink.Click();

             //fill in email and pwd 
            IWebElement email = webDriverWait.Until<IWebElement>(ExpectedConditions.ElementIsVisible(By.Id(this.loginId)));
            email.SendKeys(invalidmail);
            this.window.FindElement(By.Id(this.passwordId)).SendKeys(this.passwordText);
            //be sure login button enabled and click on 
            IWebElement sbtnSubmit = this.window.FindElement(By.Id(this.submitBtnId));
            var cssClass = sbtnSubmit.GetAttribute("class").Split(new[] { ' ' });
            Assert.IsFalse(cssClass.Any(c => c.Equals("disabled", StringComparison.InvariantCultureIgnoreCase)));
            sbtnSubmit.Click();

            //wait till   validationSummary is visible
            webDriverWait.Until<IWebElement>(ExpectedConditions.ElementIsVisible(By.Id("validationSummary")));
            Assert.IsTrue(this.window.Title.Contains("login"));

            //be sur login button disabled
            sbtnSubmit = this.window.FindElement(By.Id(this.submitBtnId));
            cssClass = sbtnSubmit.GetAttribute("class").Split(new[] { ' ' });
            Assert.IsTrue(cssClass.Any(c => c.Equals("disabled", StringComparison.InvariantCultureIgnoreCase)));


            //assert  email is filled by the invalid value
            email = webDriverWait.Until<IWebElement>(ExpectedConditions.ElementIsVisible(By.Id(this.loginId)));
            var value = email.GetAttribute("value");
            Assert.IsTrue(value.Equals(invalidmail,StringComparison.InvariantCultureIgnoreCase));

            //send valid values and login 
            email.Clear();
            email.SendKeys(this.loginText);

            this.window.FindElement(By.Id(this.passwordId)).SendKeys(this.passwordText);

            //be sur login button enabled
            cssClass = sbtnSubmit.GetAttribute("class").Split(new[] { ' ' });
            Assert.IsFalse(cssClass.Any(c => c.Equals("disabled", StringComparison.InvariantCultureIgnoreCase)));
            
            sbtnSubmit.Click();

            webDriverWait.Until<IWebElement>(ExpectedConditions.ElementIsVisible(By.Id(this.loginstatus)));
            Assert.IsTrue(this.window.Title.Contains("LMS"));

        }
Example #31
0
 public static void ProcessBankwire(IWebDriver driver, WebDriverWait wait)
 {
     driver.FindElement(By.ClassName("bankwire")).Click();
     wait.Until(D => driver.FindElement(By.CssSelector("button.btn.btn-default.button-medium")));
 }
Example #32
0
        private async Task LoginAsync(IWebDriver driverlocal, WebDriverWait localwait)
        {
            //page 1
            driverlocal.Navigate().GoToUrl(Constants.LiveLoginUrl);

            var username = localwait.Until(d => d.FindElement(By.Name(Constants.LoginEntryName)));

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

            await Task.Delay(1000);

            //page2
            var passwordEntry = localwait?.Until(d => d.FindElement(By.Id(Constants.PasswordEntryId)));

            try
            {
                var checkbox = driverlocal.FindElement(By.Name(Constants.RememberMeCheckboxName));
                checkbox?.Click();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Debug.WriteLine(ex.StackTrace);
            }
            passwordEntry.SendKeys(password);

            passwordEntry.SendKeys(Keys.Enter);

            try
            {
                var dontShowThisAgain = localwait.Until(driver => driver.FindElement(By.Id(Constants.CheckboxId)));

                dontShowThisAgain?.Click();

                var yesButton = localwait.Until(d => d.FindElement(By.Id(Constants.IdSIButton9)));

                yesButton?.Click();
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Debug.WriteLine(ex.StackTrace);
                try
                {
                    var yesButton = localwait.Until(d => d.FindElement(By.Id(Constants.IdSIButton9)));
                    yesButton?.Click();
                }
                catch (Exception ex2)
                {
                    Debug.WriteLine(ex2.Message);
                    Debug.WriteLine(ex2.StackTrace);
                }
            }
            finally
            {
                if (FindElementSafely(localwait, d => d.Title.Equals(Constants.RewardsPageTitle)))
                {
                    driverlocal.SwitchTo().DefaultContent();
                }
            }
        }
        public static IWebElement WaitForElement(IWebDriver driver, By by, int timeOutinSeconds)
        {
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(timeOutinSeconds));

            return(wait.Until(ExpectedConditions.ElementIsVisible(by)));
        }
Example #34
0
        public bool IsLoginPageDisplayed()
        {
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(15));

            return(wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.UrlContains("/Account/Login/")));
        }
Example #35
0
 public IWebElement LOGO()
 {
     return(wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(By.CssSelector("body > header > div.header__wrapper > div > div > a > img"))));
 }
Example #36
0
        public async Task EquipmentTypes() //Run Equipment type test for JIRA FE-5226
        {
            WebDriverWait wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(10));

            //Global settings, select Equipment type.
            wait.Until(SeleniumWaitHelper.ExpectedConditions.ElementIsVisible(By.CssSelector("li.clearfix:nth-child(1) > a:nth-child(3)")));
            Driver.FindElement(By.CssSelector("li.clearfix:nth-child(1) > a:nth-child(3)")).Click();
            wait.Until(SeleniumWaitHelper.ExpectedConditions.ElementIsVisible(By.CssSelector("div.setting-container:nth-child(2) > ul:nth-child(4) > li:nth-child(3) > a:nth-child(1) > text:nth-child(1)")));
            Driver.FindElement(By.CssSelector("div.setting-container:nth-child(2) > ul:nth-child(4) > li:nth-child(3) > a:nth-child(1) > text:nth-child(1)")).Click();

            await Task.Delay(5000);

            //Select Equipment and make one inactive --> save. Verify it is no longer in view.
            wait.Until(SeleniumWaitHelper.ExpectedConditions.ElementIsVisible(By.CssSelector("#search")));
            Driver.FindElement(By.CssSelector("#search")).SendKeys("6 Burner Stove" + Keys.Enter);
            wait.Until(SeleniumWaitHelper.ExpectedConditions.ElementIsVisible(By.CssSelector(".checkbox-inline")));
            Driver.FindElement(By.CssSelector(".checkbox-inline")).Click();
            wait.Until(SeleniumWaitHelper.ExpectedConditions.ElementIsVisible(By.CssSelector("#EditItemsButton")));
            Driver.FindElement(By.CssSelector("#EditItemsButton")).Click();

            //Click 'Mark Inactive' --> Save
            wait.Until(SeleniumWaitHelper.ExpectedConditions.ElementIsVisible(By.CssSelector("#edit-items > div:nth-child(1)")));
            wait.Until(SeleniumWaitHelper.ExpectedConditions.ElementIsVisible(By.CssSelector("div.radio:nth-child(1) > label:nth-child(2)")));
            Driver.FindElement(By.CssSelector("div.radio:nth-child(1) > label:nth-child(2)")).Click();
            wait.Until(SeleniumWaitHelper.ExpectedConditions.ElementIsVisible(By.CssSelector("#edit-items > div:nth-child(1) > form:nth-child(3) > div:nth-child(4) > button:nth-child(1)")));
            Driver.FindElement(By.CssSelector("#edit-items > div:nth-child(1) > form:nth-child(3) > div:nth-child(4) > button:nth-child(1)")).Click();

            await Task.Delay(3000);


            var equipType = Driver.FindElement(By.CssSelector("tr.single:nth-child(1)")).Text; //returns string inside of inactive element

            if (!equipType.Equals("6 Burner Stove"))                                           //Pass - Made EquipType Inactive
            {
                wait.Until(SeleniumWaitHelper.ExpectedConditions.ElementIsVisible(By.CssSelector("#search")));
                Driver.FindElement(By.CssSelector("#search")).SendKeys("6 Burner Stove" + Keys.Enter);
                wait.Until(SeleniumWaitHelper.ExpectedConditions.ElementIsVisible(By.CssSelector("div.filter-group:nth-child(1) > div:nth-child(2)")));
                Driver.FindElement(By.CssSelector("div.filter-group:nth-child(1) > div:nth-child(2)")).Click();
                wait.Until(SeleniumWaitHelper.ExpectedConditions.ElementIsVisible(By.CssSelector(".checkbox-inline")));
                Driver.FindElement(By.CssSelector(".checkbox-inline")).Click();
                wait.Until(SeleniumWaitHelper.ExpectedConditions.ElementIsVisible(By.CssSelector("#EditItemsButton")));
                Driver.FindElement(By.CssSelector("#EditItemsButton")).Click();
                wait.Until(SeleniumWaitHelper.ExpectedConditions.ElementIsVisible(By.CssSelector("#edit-items > div:nth-child(1)")));
                wait.Until(SeleniumWaitHelper.ExpectedConditions.ElementIsVisible(By.CssSelector("#edit-items > div:nth-child(1) > form:nth-child(3) > div:nth-child(4) > button:nth-child(1)")));
                Driver.FindElement(By.CssSelector("#edit-items > div:nth-child(1) > form:nth-child(3) > div:nth-child(4) > button:nth-child(1)")).Click();
                await Task.Delay(2000);
            }
            else //Pass - It did not find it - type was succesfully made inactive, reverts back.
            {
                Assert.Fail("JIRA FE-5226, Test Failed did not make equipment type inactive");
                Driver.FindElement(By.CssSelector("")).Click();
            }

            //Check filters in Settings --> Equipment types
            wait.Until(SeleniumWaitHelper.ExpectedConditions.ElementIsVisible(By.CssSelector(".secondary-filter")));
            Driver.FindElement(By.CssSelector(".secondary-filter")).Click();
            wait.Until(SeleniumWaitHelper.ExpectedConditions.ElementIsVisible(By.CssSelector(".filter-popup")));
            wait.Until(SeleniumWaitHelper.ExpectedConditions.ElementIsVisible(By.CssSelector(".filter-multiselect > div:nth-child(1)")));
            Driver.FindElement(By.CssSelector("#selected0_0_1")).Click();
            Driver.FindElement(By.CssSelector("#selected0_0_10")).Click();
            await Task.Delay(1000);

            Driver.FindElement(By.CssSelector(".filter-popup > div:nth-child(4) > button:nth-child(1)")).Click();
            await Task.Delay(2000);

            Driver.FindElement(By.CssSelector("li.side-bar-icon:nth-child(4) > a:nth-child(1)")).Click();
            await Task.Delay(3000);
        }
Example #37
0
 public static void ProcessCarrier(IWebDriver driver, WebDriverWait wait)
 {
     driver.FindElement(By.Id("cgv")).Click();
     driver.FindElement(By.Name("processCarrier")).Click();
     wait.Until(D => D.FindElement(By.ClassName("bankwire")));
 }
Example #38
0
 public void WaitUntil(Func <IWebDriver, IWebElement> condition) => driverWait?.Until(condition);
Example #39
0
        public void FullE2eTest()
        {
            Browser.Manage().Window.FullScreen();
            Navigate("/login");
            DisableRecaptcha();
            Assert.Equal("TOSS", Browser.Title);
            //load and redirect to /login
            _webDriveWaitDefault.Until(b => b.FindElement(By.Id("NewEmail")) != null);

            //subscribe
            Browser.FindElement(By.Id("NewEmail")).SendKeys(SubscribeEmail);
            Browser.FindElement(By.Id("NewName")).SendKeys(SubscribeLogin);
            Browser.FindElement(By.Id("NewPassword")).SendKeys(SubscribePassword);
            Browser.FindElement(By.Id("NewConfirmPassword")).SendKeys(SubscribePassword);
            Browser.FindElement(By.Id("BtnRegister")).Click();
            _webDriveWaitDefault.Until(b => b.FindElement(By.Id("NewEmail")).GetAttribute("value") == "");

            //validate subscription
            var confirmationLink = _serverFixture.EmailSender.GetConfirmationLink(SubscribeEmail);

            Browser.Navigate().GoToUrl(confirmationLink);
            DisableRecaptcha();
            _webDriveWaitDefault.Until(b => b.Url.EndsWith("/login"));

            //log in
            Browser.FindElement(By.Id("UserName")).SendKeys(SubscribeLogin);
            Browser.FindElement(By.Id("Password")).SendKeys(SubscribePassword);
            Browser.FindElement(By.Id("BtnLogin")).Click();
            _webDriveWaitDefault.Until(b => b.Url.EndsWith("/"));

            //publish toss
            Browser.FindElement(By.Id("BtnOpenNewToss")).Click();
            _webDriveWaitDefault.Until(b => b.FindElement(By.Id("TxtNewToss")).Displayed);
            string newTossContent = @"lorem ipsum lorem ipsumlorem ipsum lorem ipsumlorem ipsum lorem ipsumlorem ipsum lorem ipsum #test";

            Browser.FindElement(By.Id("TxtNewToss")).SendKeys(newTossContent);
            Browser.FindElement(By.Id("BtnNewToss")).Click();
            _webDriveWaitDefault.Until(b => !b.FindElements(By.CssSelector(".modal-backdrop")).Any());

            //add new toss x 2
            Browser.FindElement(By.Id("BtnOpenNewToss")).Click();
            _webDriveWaitDefault.Until(b => b.FindElement(By.Id("TxtNewToss")).Displayed);
            Browser.FindElement(By.Id("TxtNewToss")).SendKeys(@" lorem ipsum lorem ipsumlorem ipsum lorem ipsumlorem ipsum  lorem ipsumlorem ipsum lorem ipsum #toto");
            Browser.FindElement(By.Id("BtnNewToss")).Click();
            _webDriveWaitDefault.Until(b => !b.FindElements(By.CssSelector(".modal-backdrop")).Any());

            //add new hashtag
            Browser.FindElement(By.Id("TxtAddHashTag")).SendKeys(@"test");
            Browser.FindElement(By.Id("BtnAddHashTag")).Click();
            _webDriveWaitDefault.Until(b => b.FindElements(By.CssSelector(".tag-link")).Any());

            //filter on hashtag
            Browser.FindElement(By.CssSelector(".tag-link")).Click();
            _webDriveWaitDefault.Until(b => b.FindElement(By.CssSelector(".toss .card-text")).Text == newTossContent);

            //sign out

            Browser.FindElement(By.Id("LinkLogout")).Click();
            _webDriveWaitDefault.Until(b => b.Url.EndsWith("/login"));
            //reset password
            //click reset link
            //do reset password
            //connect
        }
Example #40
0
 public AdminLoginPage GoToLoginAdminPage(IWebDriver driver)
 {
     driver.Url = "http://localhost/litecart/admin/login.php";
     wait.Until(ExpectedConditions.TitleIs("My Store"));
     return(new AdminLoginPage(driver));
 }
Example #41
0
        //Waiting for element to be clickable
        public void WaitElement(IWebElement element)
        {
            WebDriverWait wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(20));

            wait.Until(ExpectedConditions.ElementToBeClickable(element));
        }
Example #42
0
 public static void ProcessAddress(IWebDriver driver, WebDriverWait wait)
 {
     driver.FindElement(By.Name("processAddress")).Click();
     wait.Until(D => D.FindElement(By.Id("cgv")));
 }