public Boolean AddDeviceToCartAndVerify() { new WebDriverWait(PropertyCollection.driver, TimeSpan.FromSeconds(5)).Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(lnkDeviceOnePlus)); lnkDeviceOnePlus.Click(); btnAddToCart.Click(); PropertyCollection.PublishMessage("Device1 Added to Cart"); try { lnkViewCart.Click(); navCart.Click(); } catch (Exception ex) { navCart.Click(); } string text = PropertyCollection.driver.FindElement(By.ClassName("sc-list-item-content")).Text; if (text.Contains("OnePlus 7")) { PropertyCollection.PublishMessage("Device1 present in Cart"); return(true); } else { PropertyCollection.PublishMessage("Device1 is not present in Cart"); return(false); } }
public Boolean DeleteAndVerify() { lnkDelete.Click(); PropertyCollection.PublishMessage("Device1 deleted from Cart"); System.Threading.Thread.Sleep(2000); string bodytext = lnkBodyText.Text; if ((bodytext.Contains("OnePlus 7 (Red, 8GB RAM, 256GB Storage) was removed from Shopping Cart."))) { PropertyCollection.PublishMessage("Device1 deletion verified"); return(true); } { PropertyCollection.PublishMessage("Device1 is not deleted from Cart"); return(false); } }
public Boolean SignInAndVerify(string strUsername, string strPassword) { new WebDriverWait(PropertyCollection.driver, TimeSpan.FromSeconds(5)).Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(lnkSignIn)); lnkSignIn.Click(); txtMail.SendKeys(strUsername); btnContinue.Click(); txtPassword.SendKeys(strPassword); btnSignInSubmit.Click(); PropertyCollection.PublishMessage("User Signed in successfully"); string text2 = PropertyCollection.driver.FindElement(By.Id("sc-active-cart")).Text; if (text2.Contains("OnePlus 7")) { PropertyCollection.PublishMessage("Device1 added to Cart & verified after sign in"); return(true); } else { PropertyCollection.PublishMessage("Device1 is not added to Cart"); return(false); } }