/// <summary> /// Pointing input field to a file. /// Use file URI scheme or absolute path for separate files: file://host/path; eg. file://localhost/c:/WINDOWS/clock.avi /// Use Spring.Net notation for embedded resources: assembly://<AssemblyName>/<NameSpace>/<ResourceName>; eg. assembly://HtmlElements-DotNet/Yandex.HtmlElements/TestResource.txt /// For embedded resources the resource will be unpacked to a temp dir. /// </summary> /// <param name="fileName"></param> public void SetFileToUpload(string fileName) { // Proxy can't be used to check the element class, so find real WebElement IWebElement fileInputElement = GetNotProxiedInputElement(); // Set local file detector in case of remote driver usage if (HtmlElementUtils.IsOnRemoteWebDriver(fileInputElement)) { SetLocalFileDetector((RemoteWebElement)fileInputElement); } string filePath = GetFilePath(fileName); fileInputElement.SendKeys(filePath); }