我想附上一個文件上傳。測試的一部分,我在嘗試以下,但它不工作Selenium WebDriver c#是否可以附加文件上傳
1) Enter some details into the input fields
2) Click Browse on the Web site
3) Enter a file path in the windows popup that appears
4) Click Open on the windows popup
5) Click Apply on the Web site
Driver.FindElement(By.Id("Name")).SendKeys(name);
Driver.FindElement(By.Id("EmailAddress")).SendKeys(email);
Driver.FindElement(By.Id("TelephoneNumber")).SendKeys(telephone.ToString());
Driver.FindElement(By.Name("file")).Click();
Driver.SwitchTo().ActiveElement().SendKeys("/home/likewise-open/GLOBAL/123/Documents/filename.txt");
Driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
Driver.FindElement(By.Id("convertButton"));
http://stackoverflow.com/questions/11256732/how-to-handle-windows-file-upload-using-selenium-webdriver 可能重複 –