WebDriverException: unknown error: cannot focus element

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

WebDriverException: unknown error: cannot focus element

rickman


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 my code:

       
WebElement titleBox = driver.findElement(By.xpath("//*[@id='root']/div/div[2]/div/div/div[2]/div[1]"));
        //titleBox.click();
        //titleBox.sendKeys("Test Title");

        Actions action = new Actions(driver);
        action.moveToElement(titleBox).click();
        titleBox.sendKeys("Test Title");

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: 45 milliseconds

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/52915be3-778c-4534-9e1c-1e798d906c75%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: WebDriverException: unknown error: cannot focus element

Monika Singhal
Hi,

You are trying to enter a text in some div element. Please find the correct xpath of the text box and then enter text in that box using the sendkeys method.

Thanks & Regards,
Monika


On Thursday, June 1, 2017 at 9:59:51 AM UTC+5:30, rickman wrote:


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 my code:

       
WebElement titleBox = driver.findElement(By.xpath("//*[@id='root']/div/div[2]/div/div/div[2]/div[1]"));
        //titleBox.click();
        //titleBox.sendKeys("Test Title");

        Actions action = new Actions(driver);
        action.moveToElement(titleBox).click();
        titleBox.sendKeys("Test Title");

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: 45 milliseconds

--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/selenium-users/79dac539-6431-4def-ade9-0f1e40e5e320%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...