public void test() { SetMethods.EnterText(numberBox, "00618971341641"); Thread.Sleep(800); Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed"); ClosePopUp.Click(); }
public void test() { generateTXT.Click(); string text = GetMethods.GetTextValue(generateTXT); Console.WriteLine(text); Regex regex = new Regex(@"\d+"); Match match = regex.Match(text); if (match.Success) { SetMethods.EnterText(firstNum, match.Value); } match = match.NextMatch(); if (match.Success) { SetMethods.EnterText(secNum, match.Value); } match = match.NextMatch(); if (match.Success) { SetMethods.EnterText(thirdNum, match.Value); } firstNum.Click(); Thread.Sleep(800); Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed"); ClosePopUp.Click(); }
public void test() { if (letters.Text.Equals("AAA")) { SetMethods.EnterText(enterCount, "3"); } if (letters.Text.Equals("BBB")) { SetMethods.EnterText(enterCount, "4"); } if (letters.Text.Equals("CCC")) { SetMethods.EnterText(enterCount, "2"); } if (letters.Text.Equals("DDD")) { SetMethods.EnterText(enterCount, "5"); } if (letters.Text.Equals("EEE")) { SetMethods.EnterText(enterCount, "1"); } Thread.Sleep(800); Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed"); ClosePopUp.Click(); }
public void test() { DateTime tomorrow = DateTime.Now.AddDays(1); string date = tomorrow.ToString("d"); string finalDate = ""; Regex dayMonth = new Regex(@"\d{1,2}"); Regex year = new Regex(@"\d{4}"); Match match = dayMonth.Match(date); if (match.Success) { finalDate = finalDate + match.Value + "."; } match = match.NextMatch(); if (match.Success) { finalDate = finalDate + match.Value + "."; } match = year.Match(date); if (match.Success) { finalDate = finalDate + match.Value; } SetMethods.EnterText(dateBox, finalDate); Thread.Sleep(800); Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed"); ClosePopUp.Click(); }
public void test() { string total = Convert.ToInt32(firstInt.Text) + Convert.ToInt32(secInt.Text) + ""; SetMethods.EnterText(result, total); Thread.Sleep(800); Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed"); ClosePopUp.Click(); }
public void test() { Password.Click(); PasswordA.Click(); SetMethods.EnterText(PasswordA, "ABC"); ClickMe.Click(); Thread.Sleep(800); Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed"); ClosePopUp.Click(); }
public void test() { int num1 = Convert.ToInt32(firstInt.Text); int num2 = Convert.ToInt32(secInt.Text); char op = Convert.ToChar(symbol.Text); Console.WriteLine(op); string sum = "" + operation(num1, num2, op); SetMethods.EnterText(result, sum); Thread.Sleep(800); Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed"); ClosePopUp.Click(); }
public void test() { Regex regex = new Regex(@"\d+\.*\d*"); string text = alertText.Text; Match match = regex.Match(text); if (match.Success) { SetMethods.EnterText(enterAmount, match.Value); } Thread.Sleep(800); Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed"); ClosePopUp.Click(); }
public void Initialize() { PropertiesCollection.driver = new ChromeDriver(); PropertiesCollection.driver.Navigate().GoToUrl("https://obstaclecourse.tricentis.com/Account/Login"); IWebElement username = PropertiesCollection.driver.FindElement(By.Id("UserName")); IWebElement password = PropertiesCollection.driver.FindElement(By.Id("Password")); IWebElement submitBtn = PropertiesCollection.driver.FindElement(By.XPath("/html/body/div[2]/div[2]/div/div/form/div[3]/button")); SetMethods.EnterText(username, "*****@*****.**"); SetMethods.EnterText(password, "tct2018P@ss"); submitBtn.Click(); //WebDriverWait waitForElement = new WebDriverWait(PropertiesCollection.driver, TimeSpan.FromSeconds(5)); //waitForElement.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[@id=\"undefined-sticky-wrapper\"]/div/div/div[1]/a/img"))); }
public void test() { booksBtn.Click(); string text = GetMethods.GetTextValue(XMLText); Console.WriteLine(text); // Copy and save into an XML file using (StreamWriter sw = File.CreateText(@"C:\Users\long\Documents\xmldoc.xml")) { sw.WriteLine(text); } // Read from the saved XML file XmlTextReader reader = new XmlTextReader(@"C:\Users\long\Documents\xmldoc.xml"); string ISBN = ""; while (reader.Read()) { if (reader.NodeType.ToString().Equals("Element")) { if (reader.Name.Equals("title")) { reader.Read(); if (reader.NodeType.ToString().Equals("Text")) { if (reader.Value.ToString().Equals("Testing Computer Software")) { // Read until ISBN row is reached for (int i = 0; i < 12; i++) { reader.Read(); } ISBN = reader.Value.ToString(); break; } } } } } SetMethods.EnterText(result, ISBN); Thread.Sleep(800); Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed"); ClosePopUp.Click(); }
public void test() { generate.Click(); Regex year1 = new Regex(@"\d{4}"); Regex monthDay = new Regex(@"\d{1,2}"); string date1 = GetMethods.GetTextValue(dateGenerated); string date2, finalDate = ""; Match match = monthDay.Match(date1); if (match.Success) { if (Convert.ToInt32(match.Value) == 11) { date2 = "-01-01"; match = year1.Match(date1); finalDate = (Convert.ToInt32(match.Value) + 1) + date2; } if (Convert.ToInt32(match.Value) == 12) { date2 = "-02-01"; match = year1.Match(date1); finalDate = (Convert.ToInt32(match.Value) + 1) + date2; } else { if ((Convert.ToInt32(match.Value) + 2 + "").Length == 1) { date2 = "-0" + (Convert.ToInt32(match.Value) + 2) + "-01"; } else { date2 = "-" + (Convert.ToInt32(match.Value) + 2) + "-01"; } match = year1.Match(date1); finalDate = Convert.ToInt32(match.Value) + date2; } } SetMethods.EnterText(dateSolution, finalDate); done.Click(); Thread.Sleep(800); Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed"); ClosePopUp.Click(); }
public void test() { generateBtn.Click(); string number; for (int i = 1; i < 13; i++) { IWebElement column1 = PropertiesCollection.driver.FindElement(By.XPath("/html/body/div[2]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div[" + i + "]/div[1]")); string name = column1.Text; if (name.Equals("order id")) { IWebElement column2 = PropertiesCollection.driver.FindElement(By.XPath("/html/body/div[2]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div[" + i + "]/div[2]")); number = column2.Text; SetMethods.EnterText(enterID, number); } } Thread.Sleep(800); Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed"); ClosePopUp.Click(); }
public void test() { // Focuses on small window to scroll PropertiesCollection.driver.SwitchTo().Frame(PropertiesCollection.driver.FindElement(By.Id("container"))); // Implement javascript to scroll window IJavaScriptExecutor js = (IJavaScriptExecutor)PropertiesCollection.driver; js.ExecuteScript("window.scrollBy(0,200)"); SetMethods.EnterText(TextBox, "Tosca"); // Focus back on entire html page PropertiesCollection.driver.SwitchTo().DefaultContent(); SubmitBtn.Click(); Thread.Sleep(800); Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed"); ClosePopUp.Click(); }
public void test() { ClickMe.Click(); string text = GetMethods.GetTextValue(GenerateText); SelectElement selectList = new SelectElement(ddl); IList <IWebElement> options = selectList.Options; for (int j = 2; j < options.Count; j++) { string optionText = options[j].Text.ToString(); Console.WriteLine("{0} : {1}", text, optionText); if (text.Equals(optionText)) { SetMethods.SelectDropDown(ddl, optionText); break; } } Submit.Click(); Thread.Sleep(800); Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed"); ClosePopUp.Click(); }
public void test() { int count = 1; try { while (count < 100) { IWebElement row = PropertiesCollection.driver.FindElement(By.XPath("//*[@id=\"rowCountTable\"]/tbody/tr[" + count + "]")); count++; } } catch (NoSuchElementException e) { count = count - 1; } SetMethods.EnterText(rowCount, "" + count); DoneBtn.Click(); Thread.Sleep(800); Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed"); ClosePopUp.Click(); }
public void test() { GenerateBtn.Click(); for (int i = 2; i < 7; i++) { IWebElement letter = PropertiesCollection.driver.FindElement(By.XPath("/html/body/div[2]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div[2]/table/tr[" + i + "]/td[1]")); IWebElement ddl = PropertiesCollection.driver.FindElement(By.XPath("/html/body/div[2]/div[1]/div[1]/div[2]/div/div[2]/div[2]/div[2]/table/tr[" + i + "]/td[2]/select")); SelectElement selectList = new SelectElement(ddl); IList <IWebElement> options = selectList.Options; for (int j = 1; j < 6; j++) { string optionText = options[j].Text.ToString(); if (CheckLetter(letter.Text).Equals(optionText.Substring(0, 1))) { SetMethods.SelectDropDown(ddl, optionText); break; } } } SubmitBtn.Click(); Thread.Sleep(800); Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed"); ClosePopUp.Click(); }
public void test() { // Add 2 years to current date DateTime christmasDay = DateTime.Now.AddYears(2); int month = christmasDay.Month; int day = christmasDay.Day; // Find number of months to add to current month christmasDay = christmasDay.AddMonths(12 - month); // Find number of days to add or subtract from current day if (day > 25) { christmasDay = christmasDay.AddDays(-(day - 25)); } else { christmasDay = christmasDay.AddDays(25 - day); } SetMethods.EnterText(EnterDay, "" + christmasDay.DayOfWeek); Thread.Sleep(800); Assert.IsTrue(Completed.Text.Contains("Good job"), "Not Completed"); ClosePopUp.Click(); }