selenium icon indicating copy to clipboard operation
selenium copied to clipboard

Sendkeys not working with Firefox 58.0.1

Open rleaplaza opened this issue 8 years ago • 4 comments

I have a problem uploading an input file embebed in a label button. My code to attach is: String idDocumento=driver.findElement(By.id("btadjuntar")).getAttribute("for"); System.out.println("Id documento: "+idDocumento); JavascriptExecutor executor=(JavascriptExecutor)driver; executor.executeScript("document.getElementById('"+idDocumento+"').style.display='yes';"); System.out.println("Subiendo el archivo de la ruta: "+path); WebElement elem = driver.findElement(By.id(idDocumento)); elem.sendKeys(path); retardo(5); The test gives an error like this Exception in thread "main" org.openqa.selenium.ElementNotInteractableException: Element is not reachable by keyboard The error is pointing to elem.sendKeys(path) The method sendkeys is not working

FF Version: 58.0.1 Geckodriver 0.18.0 Selenium jar version 3.5.3

rleaplaza avatar Jan 30 '18 22:01 rleaplaza

According to the docs, ElementNotInteractableException is Thrown to indicate that although an element is present on the DOM, it is not in a state that can be interacted with.

This means that the elem you are trying to send keys to does exist in the DOM but cannot receive the keystrokes. I suspect that it is because you are setting style.display to yes, which is not a valid display value, so it remains hidden.

maeriens avatar Jan 31 '18 08:01 maeriens

This is a question rather than an issue. Please send questions to the selenium-users group.

For issues, please provide concise reproducible test case so that we could act on this issue.

See CONTRIBUTING.md

p0deje avatar Jan 31 '18 09:01 p0deje

I could find a solution, changing the style displaying yes to block, it displayed the dynamic input file, attached the document and change the style display to none so the input file hides.

rleaplaza avatar Feb 01 '18 02:02 rleaplaza

I have a similar problem, but I just can not figure out how to solve it. Here is the part of the code that displays the listbox, I need to select and click on "Show by 12". I can not help at all with the code. Here is the listbox structure: