Is there any way to upload file in Google Chrome since Selenium RC \"attach_file\" only supports *Firefox? Any suggestion or workarounds are much appreciated.
Using IJavaScriptExecutor is to change the upload input field to click able so chrome driver won't pop-up error saying this element is non clickable.
[SetUp]
public void SetupTest()
{
driver = new ChromeDriver();
baseURL = "";
verificationErrors = new StringBuilder();
}
[Test]
public void Test()
{
IJavaScriptExecutor js = driver as IJavaScriptExecutor;
IWebElement element = driver.FindElement(By.Id("UploadFile_ButtonID"));
js.ExecuteScript("arguments[0].style.visibility = 'visible'; arguments[0].style.height = '1px'; arguments[0].style.width = '1px'; arguments[0].style.opacity = 1", element);
Thread.Sleep(1000);
element.SendKeys("D:\\path\\test\\image.jpg");
}