I have used this and it worked for me: driver.SwitchTo().Frame(1); try { Assert.AreEqual("My Next Question", driver.FindElement(By.XPath(".//*........")).Text); } catch (AssertionException) { // verificationErrors.Append("Element was not displayed"); } string element = driver.FindElement(By.XPath(".//*[@id='request........")).Text; Console.Write("Number of pending requests are: " + element); System.IO.StreamWriter file = new System.IO.StreamWriter(@"E:\New\test.txt"); file.WriteLine("Number of pending requests are: " + element); file.Close(); driver.FindElement(By.LinkText("Pending")).Click(); driver.SwitchTo().DefaultContent(); driver.FindElement(By.Id("logout-link")).Click(); driver.Quit();