OpenQA.Selenium.FormHandlingTests.ShouldBeAbleToUploadTheSameFileTwice C# (CSharp) Méthode

ShouldBeAbleToUploadTheSameFileTwice() private méthode

private ShouldBeAbleToUploadTheSameFileTwice ( ) : void
Résultat void
        public void ShouldBeAbleToUploadTheSameFileTwice()
        {
            System.IO.FileInfo inputFile = new System.IO.FileInfo("test.txt");
            System.IO.StreamWriter inputFileWriter = inputFile.CreateText();
            inputFileWriter.WriteLine("Hello world");
            inputFileWriter.Close();

            driver.Url = formsPage;
            IWebElement uploadElement = driver.FindElement(By.Id("upload"));
            Assert.IsTrue(string.IsNullOrEmpty(uploadElement.GetAttribute("value")));

            uploadElement.SendKeys(inputFile.FullName);
            uploadElement.Submit();

            driver.Url = formsPage;
            uploadElement = driver.FindElement(By.Id("upload"));
            Assert.IsTrue(string.IsNullOrEmpty(uploadElement.GetAttribute("value")));

            uploadElement.SendKeys(inputFile.FullName);
            uploadElement.Submit();
            // If we get this far, then we're all good.
        }