public void PageTitleLenta() { ngdriver.WaitForAngular(); String titleLenta = driver.Title.ToString(); Console.WriteLine("Заголовок страницы: " + titleLenta); Assert.AreEqual(titleLenta, "Главная страница"); }
public void CarlaLoginWorkerNoTerms() { // load the dashboard page string test_start = configuration["test_start_worker"]; ngDriver.Navigate().GoToUrl($"{baseUri}{test_start}"); ngDriver.WaitForAngular(); }
private void waitForPage() { driver.WaitForAngular(); wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(".in-case-search-bar-container"))); wait.Until(ExpectedConditions.ElementIsVisible(By.CssSelector(".document-wrapper"))); wait.Until(ExpectedConditions.InvisibilityOfElementLocated(By.CssSelector(".card-loading-container"))); wait.Until(ExpectedConditions.InvisibilityOfElementLocated(By.Id("spinner"))); driver.WaitForAngular(); Thread.Sleep(1000); }
/// <summary> /// Redirect can be used few times between pages /// </summary> /// <param name="count">Count of redirect</param> public void WaitLoadPage(int count = 1) { for (int i = 0; i < count; i++) { NgWebDriver.WaitForAngular(); } }
public void FirstTest() { driver.Navigate().GoToUrl(URL); ngDriver.WaitForAngular(); //Find product price text box using the ng-model NgWebElement ProductPrice = ngDriver.FindElement(NgBy.Model("productPrice")); ProductPrice.SendKeys(TestContext.DataRow["ProductPrice"].ToString()); Thread.Sleep(2000); //Find discount text box using the ng-model NgWebElement DiscountOnProduct = ngDriver.FindElement(NgBy.Model("discountPercent")); DiscountOnProduct.SendKeys(TestContext.DataRow["DiscountOnProduct"].ToString()); Thread.Sleep(2000); //Find button using selenium locator XPath NgWebElement BtnPriceAfterDiscount = ngDriver.FindElement(By.XPath("//*[@id='f1']/fieldset[2]/input[1]")); BtnPriceAfterDiscount.Click(); Thread.Sleep(2000); //Find discounted product text box using the ng-model NgWebElement afterDiscountValue = ngDriver.FindElement(NgBy.Model("afterDiscount")); string value = afterDiscountValue.GetAttribute("value"); Thread.Sleep(2000); //Assert for corect value Assert.AreEqual <string>(TestContext.DataRow["AfterDiscountPrice"].ToString(), value); }
public void SetUp() { driver.Navigate().GoToUrl(Config.Url); driver.Manage().Window.Maximize(); driver.Manage().Timeouts().AsynchronousJavaScript = TimeSpan.FromSeconds(10); ngDriver.WaitForAngular(); ngDriver.Url = driver.Url; }
public void Given_I_have_entered_P0_into_the_search_bar(string city) { //Send city to search box and set active var search = _ngDriver.FindElement(By.XPath("//input[@name='search']")); search.SendKeys(city); search.Click(); _ngDriver.WaitForAngular(); //Verify Selected Element is Correct, if not select if (_ngDriver.FindElement(NgBy.Binding("getPresName($index)")).Text.ToLower() != city.ToLower()) { _ngDriver.FindElements(NgBy.Repeater("item in results | limitTo:10")). First(x => x.Text == city).Click(); } }
public void setup() { var options = new ChromeOptions(); options.AddArgument("start-maximized"); driver = new ChromeDriver(options); ngdriver = new NgWebDriver(driver); driver.Navigate().GoToUrl(profileSTR); ngdriver.WaitForAngular(); }
public void RunBeforeAllTestLogin() { /////extent = ExtentManager.Instance; var loginPage = new LoginPage(_browser); WaitForElementID("loginInputEmail"); loginPage.LoginToApplication(); _browser.WaitForAngular(); }
private void SetScriptAndCreateMetadata(string script) { IWebElement weMetaScript = FindOneById("metaScript"); weMetaScript.SendKeys(Keys.Control + "a"); weMetaScript.SendKeys(Keys.Delete); Assert.AreEqual("", GetElementValue(weMetaScript)); if (script != null) { weMetaScript.SendKeys(script); } driver.WaitForAngular(); IWebElement weCreateMetadataButton = FindOneById("createMetadataButton"); Assert.IsTrue(weCreateMetadataButton.Displayed); Assert.IsTrue(weCreateMetadataButton.Enabled); weCreateMetadataButton.Click(); driver.WaitForAngular(); }
public void BeforeScenario() { driver = Driver.WedDriver; driver.Navigate().GoToUrl(Config.Url); driver.Manage().Window.Maximize(); driver.Manage().Timeouts().AsynchronousJavaScript = TimeSpan.FromSeconds(10); ngDriver = Driver.Instance; ngDriver.WaitForAngular(); ngDriver.Url = driver.Url; }
public void PerformNgByModelAction() { driver.Navigate().GoToUrl(base_url); ngDriver.Url = driver.Url; ngDriver.FindElement(By.CssSelector("[ng-click='customer()']")).Click(); ReadOnlyCollection <NgWebElement> ng_customers = ngDriver.FindElements(NgBy.Repeater("cust in Customers")); for (int iCust = 0; iCust < ng_customers.Count; iCust++) { ng_customers[3].Click(); } ngDriver.FindElement(By.CssSelector("[type='submit']")).Click(); ngDriver.WaitForAngular(); ReadOnlyCollection <NgWebElement> ng_accounts = ngDriver.FindElements(NgBy.Model("accountNo")); int iaccounts = ng_accounts.Count; var selectedaccount = ngDriver.FindElement(NgBy.Binding("accountNo")); var selectedaccountno = selectedaccount.Text; ngDriver.WaitForAngular(); }
public void Setup() { driver = new EdgeDriver(); driver.Navigate().GoToUrl("http://todomvc.com/examples/angularjs/#/"); driver.Manage().Window.Maximize(); ngDriver = new NgWebDriver(driver); ngDriver.Manage().Timeouts().SetScriptTimeout(new TimeSpan(0, 0, 15)); ngDriver.WaitForAngular(); WebDriverWait wait = new WebDriverWait(ngDriver, new TimeSpan(0, 0, 15)); wait.Until(ExpectedConditions.ElementToBeClickable(By.Id("new-todo"))); ngDriver.ExecuteScript("window.localStorage.clear();"); }
public bool SignUpLinkIsDisplayed() { _ngWebDriver.WaitForAngular(); try { return(SignUpLink.Displayed); } catch (NoSuchElementException e) { return(false); } }
public static void WaitForAngularToFinish(IWebDriver driver) { try { var ngDriver = new NgWebDriver(driver); ngDriver.Manage().Timeouts().AsynchronousJavaScript = TimeSpan.FromSeconds(10); ngDriver.WaitForAngular(); Thread.Sleep(500); } catch { // ignored } }
public void Open(string url) { ChromeOptions options = new ChromeOptions(); options.AddArgument("--start-maximized"); driver = new ChromeDriver(DriverPath, options); driver.Manage().Timeouts().PageLoad = TimeSpan.FromMinutes(5); driver.Manage().Timeouts().AsynchronousJavaScript = TimeSpan.FromMinutes(5); ngDriver = new NgWebDriver(driver) { Url = url }; ngDriver.WaitForAngular(); }
public void TestMethod1() { ngdriver.Url = URL; ngdriver.WaitForAngular(); //Find product price text box using the ng-model NgWebElement ProductPrice = ngdriver.FindElement(NgBy.Model("productPrice")); ProductPrice.SendKeys("799"); Thread.Sleep(2000); //Find discount text box using the ng-model NgWebElement DiscountOnProduct = ngdriver.FindElement(NgBy.Model("discountPercent")); DiscountOnProduct.SendKeys("10"); Thread.Sleep(2000); //Find button using selenium locator XPath NgWebElement BtnPriceAfterDiscount = ngdriver.FindElement(By.XPath("//*[@id='f1']/fieldset[2]/input[1]")); BtnPriceAfterDiscount.Click(); Thread.Sleep(2000); //Find discounted product text box using the ng-model NgWebElement afterDiscountValue = ngdriver.FindElement(NgBy.Model("afterDiscount")); string value = afterDiscountValue.GetAttribute("value"); Thread.Sleep(2000); //Assert for corect value Assert.AreEqual <string>("719.1", value); //Use if condition for custom checks if (value == "719.1") { //Do Nothing. } else { Assert.Fail(); } }
public void mobilephone(String a, String expectedresult) { IWebElement tel_field = driver.FindElement(By.XPath(tel_xpath)); IWebElement empty_field = driver.FindElement(By.XPath(empty)); tel_field.Click(); tel_field.SendKeys(a); empty_field.Click(); driver.Navigate().Refresh(); ngdriver.WaitForAngular(); NgWebElement lastpostTime = ngdriver.FindElement(By.CssSelector("#DeltaPlaceHolderMain > app-intry > div > app-profile-view > div.content > app-profile-feed-view > app-profile-feed > app-post:nth-child(2) > div > div > div.post__author.ng-star-inserted > div > span.link-profile__subtext")); NgWebElement lastPOSTcellphone = ngdriver.FindElement(By.CssSelector("#DeltaPlaceHolderMain > app-intry > div > app-profile-view > div.content > app-profile-feed-view > app-profile-feed > app-post:nth-child(2) > div > div > div.post__text.ng-star-inserted")); String innertext = lastPOSTcellphone.GetAttribute("innerHTML"); String outertext = lastpostTime.GetAttribute("outerText"); Console.WriteLine(innertext); Console.WriteLine(outertext); Assert.AreEqual(expectedresult, innertext); }
/// <summary> /// Wait when angular page was loaded /// </summary> /// <param name="page">Wait this page</param> /// <param name="timeoutBtwErrors">ms</param> /// <param name="countErrors">Count of errors</param> public void WaitLoadPage(PageBase page, int timeoutBtwErrors = 500, int countErrors = 5) { for (int i = 1; i <= countErrors; i++) { try { NgWebDriver.WaitForAngular(); Assert.AreEqual(page.ExpectedUrl, ngWebDriver.Url); } catch (Exception) { if (i == countErrors) { throw; } System.Threading.Thread.Sleep(timeoutBtwErrors); } } }
public void Initial() { urlBase = "http://portal-dr.epiq11.com/#/search/searchcases"; userName = "******"; passWord = "******"; _driver = new ChromeDriver(); driver = new NgWebDriver(_driver); takesScreenshot = _driver as ITakesScreenshot; wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(60)); driver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(60)); driver.Manage().Timeouts().SetScriptTimeout(TimeSpan.FromSeconds(60)); driver.Manage().Window.Maximize(); driver.Navigate().GoToUrl(urlBase); driver.FindElement(By.Id("sign-in")).Click(); driver.FindElement(By.Id("user-name-field")).SendKeys(userName); driver.FindElement(By.Id("pass-field")).SendKeys(passWord); driver.FindElement(By.CssSelector("input[value='Sign In']")).Click(); wait.Until(ExpectedConditions.ElementIsVisible(By.Id("search-options-section"))); driver.WaitForAngular(); }
public void TestMethod() { ObjectRepository.Driver.Manage().Timeouts().AsynchronousJavaScript = TimeSpan.FromSeconds(60); ObjectRepository.Driver.Navigate().GoToUrl("https://www.copaair.com/en/web/us"); var ngDriver = new NgWebDriver(ObjectRepository.Driver); var list = ngDriver.FindElements(NgBy.Repeater("item in desktopBookingTabs")); var element = list.First((x) => { return(x.Text.Contains("Manage your booking")); }); element.Click(); ngDriver.WaitForAngular(); ngDriver.FindElement(NgBy.Model("remoteSearchCriteria.travelerLastName")).SendKeys("Thisistest"); ngDriver.FindElement(NgBy.Model("bookingReference")).SendKeys("121421445252"); ngDriver.FindElement(By.Id("sendReservationForm")).Click(); Thread.Sleep(TimeSpan.FromSeconds(5)); }
//wait for angular js to load public void waitForAngular(NgWebDriver NgDriver) { NgDriver.WaitForAngular(); }
public void FillInMainSearchInput(string searchQuery) { _ngDriver.FindElement(MainSearchLocator).SendKeys(searchQuery); log.Info($"User input '{searchQuery}' to the main search input"); _ngDriver.WaitForAngular(); }
public TrendsPage(IWebDriver driver) : base(driver) { _ngDriver = new NgWebDriver(driver); log.Info("User navigates into Trends page"); _ngDriver.WaitForAngular(); }
public EmployeeManagementPage(IWebDriver driver) : base(driver) { ngDriver = new NgWebDriver(_driver); PageFactory.InitElements(_driver, this); ngDriver.WaitForAngular(); }
public void WaitForAngular() { ngDriver.IgnoreSynchronization = true; ngDriver.WaitForAngular(); }
private void ScrollTable() { ngDriver.WaitForAngular(); ngDriver.ExecuteScript("window.scrollTo(0, document.body.scrollHeight)"); Thread.Sleep(1000); }
public ExplorePage(IWebDriver driver) : base(driver) { _ngDriver = new NgWebDriver(driver); log.Info("User navigates into Explore page"); _ngDriver.WaitForAngular(); }
public void ClickElement(IWebElement element) { // ScrollToView(element); element.Click(); ngDriver.WaitForAngular(); }
public LoginLogoutPage(IWebDriver driver) : base(driver) { ngDriver = new NgWebDriver(_driver); PageFactory.InitElements(_driver, this); ngDriver.WaitForAngular(); }