getting cannot focus element in chrome and edge using java/selenium

For future reference, if others run into this issue, make sure you're only finding one element! Chrome tools can be deceiving sometimes when it comes to this. I re-checked my selector in firePath (firefox add-on) and it turned out that I had two matching nodes, even though chrome tools showed me one element.

https://addons.mozilla.org/en-US/firefox/addon/firepath/


sendkeys method is the problem as per the stack trace.

at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:121)

Please try Actions class to first focus on the element then send required keys.

Actions actions = new Actions(driver);
actions.moveToElement(element);
actions.click();
actions.sendKeys("SOME DATA");
actions.build().perform();

The Actions resolution did work after all. I apparently had an extra driver.findElementBy line that should have been commented out as it was a duplicate to something I had moved to another location.

Thanks for your help!!