public void Logout() { try { NickName.Click(); List <IWebElement> lstProfileitem = new List <IWebElement>(lstProfile.FindElements(By.TagName("button"))); if (lstProfileitem.Count > 0) { foreach (var item in lstProfileitem) { if (item.Text.Contains("Abmelden")) { Console.WriteLine("Successfully Logging off"); item.Click(); System.Threading.Thread.Sleep(5000); Assert.AreEqual(true, SignInButton.Displayed); } } } } catch (Exception) { throw; } }