I am running the below code snippet in Firefox Browser:
WebElement uploadControl = driver.findElement(By.cssSelector("input[type='file']"));
String file = "C:\\other\\abc.jpg";
uploadControl.sendKeys(file);
To note the Webelement is actually inside a shadow dom which I am fetching using JavascriptExecutor and storing it as 'uploadControl'.
When executing this code in Firefox browser, it gives error:
Org.openqa.selenium.ElementNotInteractableException: Element <input typ="file"> is not reachable by keyboard.
I tried to use JavascriptExecutor in place of sendKeys but it does not work.
Note: I already saw this question: org.openqa.selenium.ElementNotInteractableException: Element is not reachable by keyboard: while sending text to FirstName field in Facebook as well and tried different solutions but nothing works.