public void WaitForSend() { Driver.Wait.Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(bySuccessfullSendMessageXPath)); }
public void FirstResult() { wait.Until(ExpectedConditions.ElementToBeClickable(offers));//first result chooseBtn[0].Click(); }
public bool ExisteBtnCheckout() { wait.Until(ExpectedConditions.ElementIsVisible(cartPage.BtnCheckout)); return(VerifyExist(cartPage.BtnCheckout, _driver)); }
public string GetBadDestinationError() { wait.Until(ExpectedConditions.ElementIsVisible(By.Id("flights_destination2-error"))); return(cityToError.Text); }
public override bool WaitUntilIsLoaded() { _driverWait.Until(ExpectedConditions.ElementExists(Search)); return(_driver.FindElement(Search).Displayed); }
public void FlightStatus() { FlightStatusButton.Click(); wait.Until(ExpectedConditions.ElementIsVisible(MembershipNumber)).SendKeys("284"); FindFlight.Click(); }
public void SystemTest2() { using (var driver = new ChromeDriver()) { /* Opening Configuration File and Loading Init Data */ if (File.Exists("configurationfile.xml") == false) { throw new Exception("Configuration file do not exists in the program's directory."); } XmlDocument configurationFile = new XmlDocument(); configurationFile.Load("configurationfile.xml"); string projectName = configurationFile.SelectSingleNode("//project").InnerText; string settingInProgess = configurationFile.SelectSingleNode("//setting_inprogress").InnerText; string settingCompleted = configurationFile.SelectSingleNode("//setting_completed").InnerText; if (projectName == String.Empty || settingInProgess == String.Empty || settingCompleted == String.Empty) { throw new Exception(String.Format("At least one of the configuration arguments is empty. ProjectName: {0}, SettingInProgressName: {1}, SettingCompletedName: {2}", projectName, settingInProgess, settingCompleted)); } /* Initializing the Driver and Navigating to TMS Home Page */ var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60)); driver.Manage().Window.Maximize(); driver.Navigate().GoToUrl("https://tms.lionbridge.com/"); wait.Until(ExpectedConditions.UrlMatches("https://tms.lionbridge.com/")); /**/ TMSProjectsPage tmsProjectsPage = new TMSProjectsPage(driver); tmsProjectsPage.ClickChosenProject(projectName); TMSProjectHomePage tmsProjectHomePage = new TMSProjectHomePage(driver); tmsProjectHomePage.ChangeItemsPerPageToMinimum(driver); tmsProjectHomePage.StatusClick(); TMSStatusPage tmsStatusPage = new TMSStatusPage(driver); tmsStatusPage.AssingeeClick(); TMSAssigneesSubpage tmsAssigneesSubpage = new TMSAssigneesSubpage(driver); tmsAssigneesSubpage.InitializeFiltersPanel(driver); if (tmsAssigneesSubpage.AssigneeCount == 1) { throw new Exception("Activities drop down list is empty. Program now will shut down. "); } tmsAssigneesSubpage.ChoseActivityOption(driver, settingInProgess); tmsAssigneesSubpage = new TMSAssigneesSubpage(driver); /*PageNavBar pageNavBar = new PageNavBar(driver); * * if (pageNavBar.ItemsPerPage != null) * { * pageNavBar.ItemsPerPage.ChoseDropDownOption(driver, "1000"); * }*/ tmsAssigneesSubpage = new TMSAssigneesSubpage(driver); AssigneeList assigneeList = new AssigneeList(driver); List <AssigneeData> listAssigneeData = new List <AssigneeData>(); foreach (AssigneeItem assigneeItem in assigneeList.AssigneeItemsList) { listAssigneeData.Add(new AssigneeData(assigneeItem)); } assigneeList.TagAllJobs(driver); tmsAssigneesSubpage = new TMSAssigneesSubpage(driver); tmsAssigneesSubpage.LeftMenu.JobsView.ButtonClick(); wait.Until(ExpectedConditions.ElementIsVisible(By.ClassName("r_L"))); ButtonWait buttonWait = new ButtonWait(wait, ButtonWaitEnum.ProjectPageWait); buttonWait.WaitForConditions(); JobList jobList = new JobList(driver); foreach (AssigneeData assigneeData in listAssigneeData) { foreach (AssigneeDataElement assigneeDataElement in assigneeData.assigneeDataElements) { string jobName = assigneeDataElement.jobName.Trim(); jobList.JobShowHistory(driver, jobName); HistoryPopUp historyPopUp = new HistoryPopUp(driver); historyPopUp.InitializeFiltersPanel(driver); historyPopUp.ChoseSourceLanguageOption(driver, assigneeDataElement.sourceLanguage); historyPopUp.ChoseTargetLanguageOption(driver, assigneeDataElement.targetLanguage); historyPopUp.ChoseActivityOption(driver, settingCompleted); HistoryList historyList = new HistoryList(driver); assigneeDataElement.TranslatorName = historyList.HistoryItemsList[0].HistoryItemElements[0].StepCompletedBy; historyPopUp.CloseButtonClick(driver); } } //string path = Path.Combine(Directory.GetCurrentDirectory(), "TestFile.xlsx"); string path = Path.Combine(Directory.GetCurrentDirectory(), "TestFile.csv"); using (StreamWriter sw = new StreamWriter(path)) { string[] titles = { "Project Name: " + projectName, "Completed Step: " + settingCompleted, "Ongoing Step: " + settingInProgess }; string titlesLine = String.Join(";", titles); sw.WriteLine(titlesLine); string[] headers = { "Job Name", "Reviewer Name", "Translator Name", "Source Language", "Target Language", "WordCount", "Effort" }; string headersLine = String.Join(";", headers); sw.WriteLine(headersLine); foreach (var assigneeData in listAssigneeData) { foreach (var assigneeDataElement in assigneeData.assigneeDataElements) { string[] values = { assigneeDataElement.jobName, assigneeDataElement.reviewerName, assigneeDataElement.translatorName, assigneeDataElement.sourceLanguage, assigneeDataElement.targetLanguage, assigneeDataElement.wordcount, assigneeDataElement.effort }; string line = String.Join(";", values); sw.WriteLine(line); } } sw.Flush(); } } }
public IWebElement FindElement(By by) { new WebDriverWait(_driver, TimeSpan.FromSeconds(5)).Until(ExpectedConditions.ElementIsVisible(by)); return(_driver.FindElement(by)); }
protected void WaitForWebElement(By element) { (new WebDriverWait(WebDriver, TIMEOUT)).Until(ExpectedConditions.ElementToBeClickable(element)); }
public IWebElement FindElement(By element) { WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60)); return(wait.Until(ExpectedConditions.ElementIsVisible(element))); }
public void WaitForDraftsListAppeared() { new WebDriverWait(Browser.GetDriver(), TimeSpan.FromSeconds(3)).Until( ExpectedConditions.ElementIsVisible(By.XPath(".//*[@class='AO']//*[@role ='main']"))); }
private void ClickOnMenu(string menuLabel) { new WebDriverWait(webdriver, TimeSpan.FromSeconds(Constants.WAIT_TIME_DEFAULT)).Until(ExpectedConditions.ElementIsVisible(navigationContainer)); IList <IWebElement> menuList = webdriver.FindElements(By.CssSelector("div.sidemenu div.clickable")); foreach (IWebElement menuNow in menuList) { Console.WriteLine(menuNow.Text); if (menuNow.Text.ToLower().Contains(menuLabel.ToLower())) { menuNow.Click(); break; } } }
public void WaitForResult() { wait.Until(ExpectedConditions.ElementIsVisible(By.ClassName(resultClassName))); }
public void WaitForTitle() { wait.Until(ExpectedConditions.ElementIsVisible(By.XPath(titlePath))); }
public void SelectDateForSecondTest() { wait.Until(ExpectedConditions.ElementIsVisible(DatePlus3Days)).Click(); ButtonSubmitDate.Click(); }
public void ShouldDeposit() { ngDriver.FindElement(NgBy.ButtonText("Customer Login")).Click(); ReadOnlyCollection <NgWebElement> ng_customers = ngDriver.FindElement(NgBy.Model("custId")).FindElements(NgBy.Repeater("cust in Customers")); // select customer to log in ng_customers.First(cust => Regex.IsMatch(cust.Text, "Harry Potter")).Click(); ngDriver.FindElement(NgBy.ButtonText("Login")).Click(); ngDriver.FindElement(NgBy.Options("account for account in Accounts")).Click(); // inspect the account NgWebElement ng_account_number = ngDriver.FindElement(NgBy.Binding("accountNo")); int account_id = 0; int.TryParse(ng_account_number.Text.FindMatch(@"(?<account_number>\d+)$"), out account_id); Assert.AreNotEqual(0, account_id); /* * IEnumerable<IWebElement>elements = driver.FindElements(By.CssSelector("[data-id]")); * int[] results = elements.TakeWhile(e => Regex.IsMatch(e.GetAttribute("data-id") , "[0-9]+" )).Select(x => Int32.Parse(x.GetAttribute("data-id"))).ToArray<int>(); */ int account_balance = -1; int.TryParse(ngDriver.FindElement(NgBy.Binding("amount")).Text.FindMatch(@"(?<account_balance>\d+)$"), out account_balance); Assert.AreNotEqual(-1, account_balance); NgWebElement ng_deposit_button = ngDriver.FindElement(NgBy.PartialButtonText("Deposit")); Assert.IsTrue(ng_deposit_button.Displayed); actions.MoveToElement(ng_deposit_button.WrappedElement).Build().Perform(); Thread.Sleep(500); ng_deposit_button.Click(); // core Selenium wait.Until(ExpectedConditions.ElementExists(By.CssSelector("form[name='myForm']"))); NgWebElement ng_form_element = new NgWebElement(ngDriver, driver.FindElement(By.CssSelector("form[name='myForm']"))); // deposit amount NgWebElement ng_deposit_amount = ng_form_element.FindElement(NgBy.Model("amount")); ng_deposit_amount.SendKeys("100"); // Confirm to perform deposit NgWebElement ng_submit_deposit_button = ng_form_element.FindElements(NgBy.ButtonText("Deposit")).First(o => o.GetAttribute("class").IndexOf("btn-default", StringComparison.InvariantCultureIgnoreCase) > -1); actions.MoveToElement(ng_submit_deposit_button.WrappedElement).Build().Perform(); ngDriver.Highlight(ng_submit_deposit_button, highlight_timeout); ng_submit_deposit_button.Click(); // http://www.way2automation.com/angularjs-protractor/banking/depositTx.html // inspect message var ng_message = ngDriver.FindElement(NgBy.Binding("message")); StringAssert.Contains("Deposit Successful", ng_message.Text); ngDriver.Highlight(ng_message, highlight_timeout); // re-read the amount int updated_account_balance = -1; int.TryParse(ngDriver.FindElement(NgBy.Binding("amount")).Text.FindMatch(@"(?<account_balance>\d+)$"), out updated_account_balance); Assert.AreEqual(updated_account_balance, account_balance + 100); }
public void SelectDateForThirdTest() { wait.Until(ExpectedConditions.ElementIsVisible(Date)).Click(); ButtonSubmitDate.Click(); }
public void ShouldAddCustomer() { // When I proceed to "Bank Manager Login" ngDriver.FindElement(NgBy.ButtonText("Bank Manager Login")).Click(); // And I proceed to "Add Customer" ngDriver.FindElement(NgBy.PartialButtonText("Add Customer")).Click(); // And I fill new Customer data IWebElement ng_first_name = ngDriver.FindElement(NgBy.Model("fName")); ngDriver.Highlight(ng_first_name, highlight_timeout); StringAssert.IsMatch("First Name", ng_first_name.GetAttribute("placeholder")); ng_first_name.SendKeys("John"); IWebElement ng_last_name = ngDriver.FindElement(NgBy.Model("lName")); ngDriver.Highlight(ng_last_name, highlight_timeout); StringAssert.IsMatch("Last Name", ng_last_name.GetAttribute("placeholder")); ng_last_name.SendKeys("Doe"); IWebElement ng_post_code = ngDriver.FindElement(NgBy.Model("postCd")); ngDriver.Highlight(ng_post_code, highlight_timeout); StringAssert.IsMatch("Post Code", ng_post_code.GetAttribute("placeholder")); ng_post_code.SendKeys("11011"); // NOTE: there are two 'Add Customer' buttons on this form NgWebElement ng_add_customer_button = ngDriver.FindElements(NgBy.PartialButtonText("Add Customer"))[1]; actions.MoveToElement(ng_add_customer_button.WrappedElement).Build().Perform(); ngDriver.Highlight(ng_add_customer_button, highlight_timeout); ng_add_customer_button.Submit(); // confirm string alert_text = null; try { alert = ngDriver.WrappedDriver.SwitchTo().Alert(); alert_text = alert.Text; StringAssert.StartsWith("Customer added successfully with customer id :", alert_text); alert.Accept(); } catch (NoAlertPresentException ex) { // Alert not present verificationErrors.Append(ex.StackTrace); } catch (WebDriverException ex) { // Alert not handled by PhantomJS verificationErrors.Append(ex.StackTrace); } int customer_id = 0; int.TryParse(alert_text.FindMatch(@"(?<customer_id>\d+)$"), out customer_id); Assert.AreNotEqual(0, customer_id); // And I switch to "Customers" screen ngDriver.FindElement(NgBy.PartialButtonText("Customers")).Click(); // discover newly added customer ReadOnlyCollection <NgWebElement> ng_customers = ngDriver.FindElements(NgBy.Repeater("cust in Customers")); int customer_count = ng_customers.Count; NgWebElement ng_new_customer = ng_customers.First(cust => Regex.IsMatch(cust.Text, "John Doe")); Assert.IsNotNull(ng_new_customer); actions.MoveToElement(ng_new_customer.WrappedElement).Build().Perform(); ngDriver.Highlight(ng_new_customer, highlight_timeout); // confirm searching for the customer name ngDriver.FindElement(NgBy.Model("searchCustomer")).SendKeys("John"); ng_customers = ngDriver.FindElements(NgBy.Repeater("cust in Customers")); Assert.AreEqual(1, ng_customers.Count); // show all customers again ngDriver.FindElement(NgBy.Model("searchCustomer")).Clear(); Thread.Sleep(500); wait.Until(ExpectedConditions.ElementIsVisible(NgBy.Repeater("cust in Customers"))); // discover newly added customer again ng_customers = ngDriver.FindElements(NgBy.Repeater("cust in Customers")); ng_new_customer = ng_customers.First(cust => Regex.IsMatch(cust.Text, "John Doe")); // delete new customer NgWebElement ng_delete_button = ng_new_customer.FindElement(NgBy.ButtonText("Delete")); Assert.IsNotNull(ng_delete_button); actions.MoveToElement(ng_delete_button.WrappedElement).Build().Perform(); ngDriver.Highlight(ng_delete_button, highlight_timeout); // in slow motion actions.MoveToElement(ng_delete_button.WrappedElement).ClickAndHold().Build().Perform(); Thread.Sleep(1000); actions.Release(); // sometimes actions do not work - for example in this test ng_delete_button.Click(); // wait for customer list to reload Thread.Sleep(1000); wait.Until(ExpectedConditions.ElementIsVisible(NgBy.Repeater("cust in Customers"))); // count the remaining customers ng_customers = ngDriver.FindElements(NgBy.Repeater("cust in Customers")); int new_customer_count = ng_customers.Count; // conrirm the customer count changed Assert.IsTrue(customer_count - 1 == new_customer_count); }
//move this procedure to a Helper class public void EnsurePageIsLoaded() { WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(60)); wait.Until(ExpectedConditions.ElementToBeClickable(loader)); }
public ShoppingCartPage GoToShoppingCartPage() { wait.Until(ExpectedConditions.ElementToBeClickable(shoppingCartButton)); shoppingCartButton.Click(); return(new ShoppingCartPage(driver)); }
public void SystemTest() { using (var driver = new ChromeDriver()) { /* Opening Configuration File and Loading Init Data */ if (File.Exists("configurationfile.xml") == false) { throw new Exception("Configuration file do not exists in the program's directory."); } XmlDocument configurationFile = new XmlDocument(); configurationFile.Load("configurationfile.xml"); string projectName = configurationFile.SelectSingleNode("//project").InnerText; string settingInProgess = configurationFile.SelectSingleNode("//setting_inprogress").InnerText; string settingCompleted = configurationFile.SelectSingleNode("//setting_completed").InnerText; if (projectName == String.Empty || settingInProgess == String.Empty || settingCompleted == String.Empty) { throw new Exception(String.Format("At least one of the configuration arguments is empty. ProjectName: {0}, SettingInProgressName: {1}, SettingCompletedName: {2}", projectName, settingInProgess, settingCompleted)); } /* Initializing the Driver and Navigating to TMS Home Page */ var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(60)); driver.Manage().Window.Maximize(); driver.Navigate().GoToUrl("https://tms.lionbridge.com/"); wait.Until(ExpectedConditions.UrlMatches("https://tms.lionbridge.com/")); /**/ TMSProjectsPage tmsProjectsPage = new TMSProjectsPage(driver); tmsProjectsPage.ClickChosenProject(projectName); TMSProjectHomePage tmsProjectHomePage = new TMSProjectHomePage(driver); tmsProjectHomePage.ChangeItemsPerPageToMinimum(driver); tmsProjectHomePage.StatusClick(); TMSStatusPage tmsStatusPage = new TMSStatusPage(driver); tmsStatusPage.AssingeeClick(); TMSAssigneesSubpage tmsAssigneesSubpage = new TMSAssigneesSubpage(driver); tmsAssigneesSubpage.InitializeFiltersPanel(driver); if (tmsAssigneesSubpage.AssigneeCount == 1) { throw new Exception("Activities drop down list is empty. Program now will shut down. "); } tmsAssigneesSubpage.ChoseActivityOption(driver, settingInProgess); tmsAssigneesSubpage = new TMSAssigneesSubpage(driver); /*PageNavBar pageNavBar = new PageNavBar(driver); * * if (pageNavBar.ItemsPerPage != null) * { * pageNavBar.ItemsPerPage.ChoseDropDownOption(driver, "1000"); * }*/ tmsAssigneesSubpage = new TMSAssigneesSubpage(driver); AssigneeList assigneeList = new AssigneeList(driver); List <AssigneeData> listAssigneeData = new List <AssigneeData>(); foreach (AssigneeItem assigneeItem in assigneeList.AssigneeItemsList) { listAssigneeData.Add(new AssigneeData(assigneeItem)); } assigneeList.AssigneeItemsList[0].AssigneeItemElements[0].TagSingleJob(driver); tmsAssigneesSubpage = new TMSAssigneesSubpage(driver); tmsAssigneesSubpage.LeftMenu.JobsView.ButtonClick(); wait.Until(ExpectedConditions.ElementIsVisible(By.ClassName("r_L"))); JobList jobList = new JobList(driver); jobList.JobShowHistory(driver, 0); HistoryPopUp historyPopUp = new HistoryPopUp(driver); historyPopUp.InitializeFiltersPanel(driver); historyPopUp.ChoseSourceLanguageOption(driver, listAssigneeData[0].assigneeDataElements[0].sourceLanguage); historyPopUp.ChoseTargetLanguageOption(driver, listAssigneeData[0].assigneeDataElements[0].targetLanguage); historyPopUp.ChoseActivityOption(driver, settingCompleted); HistoryList historyList = new HistoryList(driver); //historyList.HistoryItemsList[0].HistoryItemElements[0].StepCompletedByClick(driver); listAssigneeData[0].assigneeDataElements[0].translatorName = historyList.HistoryItemsList[0].HistoryItemElements[0].StepCompletedBy; string path = Path.Combine(Directory.GetCurrentDirectory(), "TestFile.xlsx"); using (SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.Create(path, SpreadsheetDocumentType.Workbook)) { // Add a WorkbookPart to the document. WorkbookPart workbookpart = spreadsheetDocument.AddWorkbookPart(); workbookpart.Workbook = new Workbook(); // Add a WorksheetPart to the WorkbookPart. WorksheetPart worksheetPart = workbookpart.AddNewPart <WorksheetPart>(); worksheetPart.Worksheet = new Worksheet(new SheetData()); // Add Sheets to the Workbook. Sheets sheets = spreadsheetDocument.WorkbookPart.Workbook. AppendChild <Sheets>(new Sheets()); // Append a new worksheet and associate it with the workbook. Sheet sheet = new Sheet() { Id = spreadsheetDocument.WorkbookPart. GetIdOfPart(worksheetPart), SheetId = 1, Name = "mySheet" }; sheets.Append(sheet); SheetData sheetData = worksheetPart.Worksheet.GetFirstChild <SheetData>(); UInt32 rowIndex = 0; foreach (var info in listAssigneeData) { var row = new Row() { RowIndex = rowIndex }; var firstNameCell = new Cell() { CellReference = "A" + (rowIndex + 1) }; firstNameCell.CellValue = new CellValue(info.assigneeDataElements[0].jobName); firstNameCell.DataType = CellValues.String; row.AppendChild(firstNameCell); Cell secondNameCell = new Cell() { CellReference = "B" + (rowIndex + 1) }; secondNameCell.CellValue = new CellValue(info.assigneeDataElements[0].sourceLanguage); secondNameCell.DataType = new EnumValue <CellValues>(CellValues.String); row.AppendChild(secondNameCell); Cell thirdNameCell = new Cell() { CellReference = "C" + (rowIndex + 1) }; thirdNameCell.CellValue = new CellValue(info.assigneeDataElements[0].targetLanguage); thirdNameCell.DataType = new EnumValue <CellValues>(CellValues.String); row.AppendChild(thirdNameCell); Cell fourthNameCell = new Cell() { CellReference = "D" + (rowIndex + 1) }; fourthNameCell.CellValue = new CellValue(info.assigneeDataElements[0].reviewerName); fourthNameCell.DataType = new EnumValue <CellValues>(CellValues.String); row.AppendChild(fourthNameCell); Cell fifthNameCell = new Cell() { CellReference = "E" + (rowIndex + 1) }; fifthNameCell.CellValue = new CellValue(info.assigneeDataElements[0].translatorName); fifthNameCell.DataType = new EnumValue <CellValues>(CellValues.String); row.AppendChild(fifthNameCell); Cell sixthNameCell = new Cell() { CellReference = "F" + (rowIndex + 1) }; sixthNameCell.CellValue = new CellValue(info.assigneeDataElements[0].effort); sixthNameCell.DataType = CellValues.String; row.AppendChild(sixthNameCell); Cell seventhNameCell = new Cell() { CellReference = "G" + (rowIndex + 1) }; seventhNameCell.CellValue = new CellValue(info.assigneeDataElements[0].wordcount); seventhNameCell.DataType = CellValues.String; row.AppendChild(seventhNameCell); sheetData.AppendChild(row); rowIndex++; } workbookpart.Workbook.Save(); } } }
public void EsperaPorElementoVisivel(By by) { wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30)); wait.Until(ExpectedConditions.ElementIsVisible(by)); }
public string GetBadOriginationError() { wait.Until(ExpectedConditions.ElementIsVisible(By.Id("flights_origin2-error"))); return(cityFromError.Text); }
public void EsperaPorElementosLocalizadosPor(By elemento, int tempo) { new WebDriverWait(driver, TimeSpan.FromSeconds(tempo)).Until(ExpectedConditions.VisibilityOfAllElementsLocatedBy(elemento)); }
public static bool IsStale(this IWebElement element) { return(ExpectedConditions.StalenessOf(element)(element.GetDriver())); }
public void AirportFlyFrom(string airportFrom) { wait.Until(ExpectedConditions.ElementIsVisible(ButtonInputFrom)).Click(); InputFrom.SendKeys(airportFrom); }
public static void ForElement(By by, IWebDriver driver, TimeSpan timeSpan) { WebDriverWait wait = new WebDriverWait(driver, timeSpan); wait.Until(ExpectedConditions.ElementExists(by)); }
public void AirportFlyTo(string airportTo) { wait.Until(ExpectedConditions.ElementIsVisible(ButtonInputTo)).Click(); InputTo.SendKeys(airportTo); }
/// <summary> /// Wait until the item is Visible /// public static void WaitForLocatorLoad(IWebDriver driver, By locator, int timeoutInSeconds = 60) { if (timeoutInSeconds > 0) { try { // Helpers.FindElement(driver, locator, timeoutInSeconds); new WebDriverWait(driver, TimeSpan.FromSeconds(timeoutInSeconds)).Until(ExpectedConditions.ElementIsVisible(locator)); //isElementPresent: //WebDriverWait wait = new WebDriverWait(driver, waitTime); //wait.until(ExpectedConditions.presenceOfElementLocated(locator)); //isElementClickable //WebDriverWait wait = new WebDriverWait(driver, waitTime); //wait.until(ExpectedConditions.elementToBeClickable(locator)); //isElementVisible //WebDriverWait wait = new WebDriverWait(driver, waitTime); //wait.until(ExpectedConditions.visibilityOfElementLocated(locator)); //or //WebDriverWait wait = new WebDriverWait(driver, waitTime); //wait.until(ExpectedConditions.visibilityOf(element)); //or all elements are visible //List<WebElement> linkElements = driver.findelements(By.cssSelector('#linkhello')); //WebDriverWait wait = new WebDriverWait(driver, waitTime); //wait.until(ExpectedConditions.visibilityOfAllElements(linkElements)); //isElementInVisible //WebDriverWait wait = new WebDriverWait(driver, waitTime); //wait.until(ExpectedConditions.invisibilityOfElementLocated(locator)); //isElementEnabled //WebElement element = driver.findElement(By.id("")); //element.isEnabled(); //isElementDisplayed //WebElement element = driver.findElement(By.id("")); //element.isDisplayed(); //Wait for invisibility of element //WebDriverWait wait = new WebDriverWait(driver, waitTime); //wait.until(ExpectedConditions.invisibilityOfElementWithText(by)); //Wait for invisibility of element with Text //WebDriverWait wait = new WebDriverWait(driver, waitTime); //wait.until(ExpectedConditions.invisibilityOfElementWithText(by, strText)); } catch (Exception ex) { Assert.Fail("Helpers method 'WaitForLocatorLoad'.\nElement: " + locator.ToString() + " does not visible.\nTest fail due to: {0}, {1}, {2}", ex.Message, ex.InnerException, ex); } } }
public void SetPassword(string password) { webDriverWait.Until(ExpectedConditions.ElementIsVisible(By.Name("password"))); PasswordField.SendKeys(password); }