I have been trying to use Selenium sendkeys() without success using Chrome. I've researched similar questions here that seemed related without success. I can spawn the URL, invoke buttons (click()) but when I attempt to enter a value within a specific text field I get:
"Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot focus element."
Would appreciate any help. Thank you!
Here's a snippet of code:
WebElement titleBox = driver.findElement(By.xpath("//*[@id='root']/div/div[2]/div/div/div[2]/div[1]"));
titleBox.click();
titleBox.sendKeys("Test Survey Title");
Here's the stack trace:
Starting ChromeDriver 2.29.461585 (0be2cd95f834e9ee7c46bcc7cf405b483f5ae83b) on port 43615 Only local connections are allowed. May 26, 2017 3:42:50 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: OSS Exception in thread "main" org.openqa.selenium.WebDriverException: unknown error: cannot focus element (Session info: chrome=58.0.3029.110) (Driver info: chromedriver=2.29.461585 (0be2cd95f834e9ee7c46bcc7cf405b483f5ae83b),platform=Mac OS X 10.12.5 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 43 milliseconds Build info: version: '3.4.0', revision: 'unknown', time: 'unknown' System info: host: 'Enriques-MacBook-Pro.local', ip: '10.0.0.208', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.5', java.version: '1.8.0_131' Driver info: org.openqa.selenium.chrome.ChromeDriver Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.29.461585 (0be2cd95f834e9ee7c46bcc7cf405b483f5ae83b), userDataDir=/var/folders/55/jxcw642x4593njd3nnysck_80000gn/T/.org.chromium.Chromium.4miVBB}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=58.0.3029.110, platform=MAC, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}] Session ID: c0d55118bf095a12cb6e105b581b149e at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215) at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:671) at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:272) at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:96) at LaunchChrome.main(LaunchChrome.java:36)