public void Should_Add_Address_Successfully() { var addAddressBo = new AddAddressBO { FirstName = "Changed AC George", ZipCode = "Changed Zip Code" }; var addressDetailsPage = addAddressPage.AddAddress(addAddressBo); Assert.AreEqual("Address was successfully created.", addressDetailsPage.SuccessfullyCreatedMessage); }
//third method private IWebElement BtnDestroyV3(AddAddressBO addAddressBo) { foreach (var element in LstAddresses) { if (element.Text.Contains(addAddressBo.FirstName)) { return(element); } break; } return(null); }
public AddressDetailsPage CreateAddress(AddAddressBO addAddressBo) { wait.Until(ExpectedConditions.ElementIsVisible(firstName)); TxtFirstName.SendKeys(addAddressBo.FirstName); TxtLastName.SendKeys(addAddressBo.LastName); TxtAddress1.SendKeys(addAddressBo.Address1); TxtCity.SendKeys(addAddressBo.City); var selectState = new SelectElement(DdlState); selectState.SelectByText(addAddressBo.State); TxtZipCode.SendKeys(addAddressBo.ZipCode); LstCountry[addAddressBo.Country].Click(); var js = (IJavaScriptExecutor)driver; js.ExecuteScript("arguments[0].setAttribute('value', arguments[1])", ClColor, addAddressBo.Color); BtnCreateAddress.Click(); return(new AddressDetailsPage(driver)); }
public void DeleteAddress(AddAddressBO addAddressBo) { BtnDestroyV2(addAddressBo).Click(); driver.SwitchTo().Alert().Accept(); }
//second method -- linq private IWebElement BtnDestroyV2(AddAddressBO addAddressBo) => LstAddresses.FirstOrDefault(element => element.Text.Contains(addAddressBo.FirstName)) ?.FindElement(destroy);