public void UploadFile() { string File = "UploadTEST.txt"; string FilePath = @"C:\Users\Lenovo Y500\Desktop\" + File; EmailPage emailPage = new EmailPage(driver); emailPage.CreateLetterBtn().Click(); emailPage.ReceiverField().SendKeys("*****@*****.**"); emailPage.SubjectField().SendKeys("Letter for test"); emailPage.DescriptionField().SendKeys("Description Test"); driver.FindElement(By.XPath("//*[@id='att']/div[2]/span[1]/i")).Click(); Thread.Sleep(2000); driver.FindElement(By.XPath("//input[@type='file']")).SendKeys(FilePath); Thread.Sleep(2000); emailPage.SentMailButton().Click(); emailPage.IncomingMailsTab().Click(); emailPage.FirstMail().Click(); }