Use an absolute path with Selenium's sendKeys.
driver.findElement(By.id("element_file")).sendKeys("C:\\path\\to\\file.txt");
# Python similar: send_keys('C:/path/to/file.txt')
// Java - Full Test
WebElement fileInput = driver.findElement(By.id("element_file"));
fileInput.sendKeys("C:\\path\\to\\file.txt");
assert fileInput.getAttribute("value").contains("file.txt");
# Python - Full Test
file_input = driver.find_element(By.ID, "element_file")
file_input.send_keys("C:/path/to/file.txt")
assert "file.txt" in file_input.get_attribute("value")
// Java - Alternative Solution
driver.findElement(By.id("element_file")).sendKeys("C:\\path\\to\\file.txt");
# Python - Alternative Solution
driver.find_element(By.ID, "element_file").send_keys("C:/path/to/file.txt")
element_file.