public static void RemoveButtons() { int i = 5; LeadsPage.ClickNameLink(); ClickEditLayoutLink(); Boolean isPresent = Driver.Instance.FindElements(By.Id(Button.ReturnId("Opt-out for Text Messages"))).Count > 0; ReturnToHomePage(); while (isPresent && i > 0) { RemoveButton.OptOut(); ClickEditLayoutLink(); isPresent = Driver.Instance.FindElements(By.Id(Button.ReturnId("Opt-out for Text Messages"))).Count > 0; ReturnToHomePage(); i--; } ClickEditLayoutLink(); isPresent = Driver.Instance.FindElements(By.Id(Button.ReturnId("Opt-in for Text Messages"))).Count > 0; ReturnToHomePage(); while (isPresent && i > 0) { RemoveButton.OptIn(); ClickEditLayoutLink(); isPresent = Driver.Instance.FindElements(By.Id(Button.ReturnId("Opt-in for Text Messages"))).Count > 0; ReturnToHomePage(); i--; } ClickEditLayoutLink(); isPresent = Driver.Instance.FindElements(By.Id(Button.ReturnId("Send Text Message"))).Count > 0; ReturnToHomePage(); while (isPresent && i > 0) { RemoveButton.SendText(); ClickEditLayoutLink(); isPresent = Driver.Instance.FindElements(By.Id(Button.ReturnId("Send Text Message"))).Count > 0; ReturnToHomePage(); i--; } }