public void ThenISeeSearchingResultPage(Table table) { string brandCar = table.Rows[0]["Brand"]; string modelCar = table.Rows[0]["Model"]; string startYearCar = table.Rows[0]["StartYear"]; string endYearCar = table.Rows[0]["EndYear"]; var dataTable = TableExtensions.ToDataTable(table); foreach (DataRow row in dataTable.Rows) { Console.WriteLine(row.ItemArray[0].ToString()); Console.WriteLine(row.ItemArray[1].ToString()); Console.WriteLine(row.ItemArray[2].ToString()); Console.WriteLine(row.ItemArray[3].ToString()); } foreach (var car in filteringPage.carTitles) { Assert.That(car.FindElement(By.XPath("./span")).Text.Contains(brandCar + " " + modelCar), "The actual brand and model of the car is search result does not according to set filtering"); string[] wordsInTitle = car.Text.Split(' '); int actualYearCar = int.Parse(wordsInTitle[wordsInTitle.Length - 1]); if (actualYearCar > int.Parse(endYearCar) || actualYearCar < int.Parse(startYearCar)) { throw new AssertionException("The actual year of the car is search result does not according to set filtering"); } } }
public void WhenEnterCredentials(Table table) { var dataTable = TableExtensions.ToDataTable(table); foreach (DataRow row in dataTable.Rows) { driver.FindElement(By.Id("username")).SendKeys(row.ItemArray[0].ToString()); driver.FindElement(By.Id("password")).SendKeys(row.ItemArray[1].ToString()); //driver.FindElement(By.Name("login")).Click(); // driver.FindElement(By.Id("username")).Clear(); //driver.FindElement(By.Id("password")).Clear(); } }