I am trying to make a YouTube video uploader to upload a video with a single click. So far I am managing to get to the http://www.youtube.com/upload
page, but I can not find a way to use the button to upload my video.
After a little research I have found out that the proper way to upload a file is uploadVid.SendKeys("C:\\video.flv");
. So far I am at this point:
// IWebElement uploadVid = driver.FindElement(By.Id("start-upload-button-single"));
// IWebElement uploadVid = driver.FindElement(By.XPath("//*[@id=\"upload-prompt-box\"]/div[1]"));
// IWebElement uploadVid = driver.FindElement(By.XPath("//*[@id=\"start-upload-button-single\"]"));
IWebElement uploadVid = driver.FindElement(By.ClassName("upload-drag-drop-description"));
uploadVid.SendKeys("C:\\video.flv");
The lines I have commented out are what I have tried so far without any success. I keep getting error element not found
.
I use C# Selenium WebDriver in VS2013, WPF.