public void HelloNgWrapperDriver() { NgDriver.Navigate().GoToUrl("https://material.angular.io/"); IWebElement element = NgDriver.WrappedDriver.FindElement(By.CssSelector("[ng-change='search(q)']")); element.Clear(); element.SendKeys("Hello Wrapper Driver"); }
public void ShouldListTodos() { NgDriver.Navigate().GoToUrl("http://www.angularjs.org"); var elements = NgDriver.FindElements(NgBy.Repeater("todo in todoList.todos")); Assert.AreEqual("build an AngularJS app", elements[1].Text.Trim()); Assert.AreEqual(false, elements[1].Evaluate("todo.done")); }
public void NonAngularPageShouldBeSupported() { Assert.DoesNotThrow(() => { NgDriver.IgnoreSynchronization = true; NgDriver.Navigate().GoToUrl("http://www.google.com"); NgDriver.IgnoreSynchronization = false; }); }
public void ShouldGreetUsingBinding() { // Instanciate a classic Selenium's WebDriver //var driver = new ChromeDriver(); // Configure timeouts (important since Protractor uses asynchronous client side scripts) //driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(5)); NgDriver.Navigate().GoToUrl("http://www.angularjs.org"); NgDriver.FindElement(NgBy.Model("yourName")).SendKeys("Julie"); Assert.AreEqual("Hello Julie!", NgDriver.FindElement(NgBy.Binding("yourName")).Text);//} }
/// <summary> /// Navigates to given url and measure time for this action including or not Ajax. /// </summary> /// <example>Sample confirmation for java script alert: <code> /// this.Driver.NavigateToAndMeasureTime("http://objectivity.co.uk", waitForAjax: true); /// </code></example> /// <param name="url">The URL.</param> /// <param name="waitForAjax">Wait or not for Ajax</param> public long NavigateToAndMeasureTime(Uri url, bool waitForAjax = false) { PerformanceHelper.Instance.StartMeasure(); NgDriver.Navigate().GoToUrl(url); if (waitForAjax) { WaitForAjax(); } PerformanceHelper.Instance.StopMeasure(); return(PerformanceHelper.Instance.GetLoadTimeList[PerformanceHelper.Instance.GetLoadTimeList.Count - 1].Duration); }
//Under the assumption that the BasePage is always created first for every test, this constructor is used to instantiate universal objects, // and execute universal logic (such as navigating to an app url), or even logging in. public BasePage(bool shouldNavigateToBaseUrl = true, LoginType loginType = LoginType.AnyUser) { LoginType = loginType; Value = new BsonDocumentValues(Mongo); SetEmailAddress(); Logger = LogManager.GetCurrentClassLogger(); Logger.Info("Tests being run on: " + BaseConfiguration.Base); SocialCredentials = new SocialCredentials(this); if (shouldNavigateToBaseUrl) { try { NgDriver.Navigate().GoToUrl(BaseConfiguration.GetUrlValue()); Thread.Sleep(1000); } catch { JSNavigate(); Thread.Sleep(1000); } } }
public void BrowserRefresh() { NgDriver.Navigate().Refresh(); }
/// <summary> /// Navigates to. /// </summary> /// <param name="url">The URL.</param> public void NavigateTo(string url) { NgDriver.Navigate().GoToUrl(url); ApproveCertificateForInternetExplorer(); }
public void Angular2Test() { NgDriver.Navigate().GoToUrl("https://material.angular.io/"); NgDriver.FindElement(By.XPath("//a[@routerlink='guide/getting-started']")).Click(); Assert.AreEqual("https://material.angular.io/guide/getting-started", NgDriver.Url); }