ericmckean / chromedriver

Automatically exported from code.google.com/p/chromedriver
0 stars 0 forks source link

sendKeys Error "TypeElement unknown error: cannot focus element", but click on this element passes #999

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I use Selenium 2.44.0, Chrome 39, chromedriver 2.12

I have reproduced this error (cannot focus element).
The strange thing is that, first click on the item passes.
In FF sendKeys(Keys.chord(Keys.CONTROL, Keys.ALT, "d")) - works correctly.
I try another cssSelector ".app-sceleton-index" or "body" - same situation, i 
have error.

Steps to reproduce:
code - https://gist.github.com/anonymous/b7112bb285b33e603e9b

Other helpful tips:
log driver - https://gist.github.com/anonymous/8203e07f293292fb7175
stacktrace - https://gist.github.com/anonymous/837bbd9758c02daa76cc

Original issue reported on code.google.com by ilovegir...@gmail.com on 10 Dec 2014 at 10:15

GoogleCodeExporter commented 9 years ago
How do you resolve 
driver.getElementByCss("html");
?
This is not on Selenium spec.

Original comment by andrewch...@google.com on 10 Dec 2014 at 6:41

GoogleCodeExporter commented 9 years ago

Original comment by andrewch...@chromium.org on 10 Dec 2014 at 6:42

GoogleCodeExporter commented 9 years ago
oh, sorry, small inaccuracy.
replace this line please:
WebElement body = driver.findElement(By.cssSelector("html"));

Original comment by ilovegir...@gmail.com on 11 Dec 2014 at 7:42

GoogleCodeExporter commented 9 years ago
also,  
https://myt.teletrade-dj.com/#index
is not available.

Original comment by andrewch...@chromium.org on 11 Dec 2014 at 6:24

GoogleCodeExporter commented 9 years ago
I'm getting the exact same error on a field thats was builtin using 
react-select for react toolkit.

Original comment by carlosmm...@gmail.com on 11 Dec 2014 at 6:44

GoogleCodeExporter commented 9 years ago
More info on my issue at: 
https://gist.github.com/carlosmmelo/ff7dc2a7c8f11cf29e10

Original comment by carlosmm...@gmail.com on 11 Dec 2014 at 7:01

GoogleCodeExporter commented 9 years ago
add to hosts  
87.239.187.146 myt.teletrade-dj.com

Original comment by ilovegir...@gmail.com on 11 Dec 2014 at 7:14

GoogleCodeExporter commented 9 years ago
for #7, those URL  are not accessible.
for #5 , #6   do you have complete Python script for us to reproduce the case?

Original comment by andrewch...@chromium.org on 11 Dec 2014 at 7:31

GoogleCodeExporter commented 9 years ago
you will not be able to access the url that my script has because is only 
accesible thru a private network.

However I can easly reproduce on any react-select box available to the world, 
so I just found this one:

http://jedwatson.github.io/react-select/

And this is the Python script to reproduce it against it: 
https://gist.github.com/carlosmmelo/51270cfadc51f12af9a3

Original comment by carlosmm...@gmail.com on 11 Dec 2014 at 8:00

GoogleCodeExporter commented 9 years ago
ilovegir...@gmail.com, I'm not sure if my issue is the same as yours (not sure 
on what type of field you are trying).

Please take a look on my last post, if it is not the same issue then I think we 
would need to separate these on a different ticket.

Original comment by carlosmm...@gmail.com on 11 Dec 2014 at 10:07

GoogleCodeExporter commented 9 years ago
better separate if not the same issue.

For #7 -  87.239.187.146 myt.teletrade-dj.com  is not accessible

Original comment by andrewch...@chromium.org on 12 Dec 2014 at 12:15

GoogleCodeExporter commented 9 years ago

Where I can find source page with following information?
'#example > div:nth-child(1) > div:nth-child(1) > div:nth-child(2)'

Original comment by andrewch...@chromium.org on 12 Dec 2014 at 1:58

GoogleCodeExporter commented 9 years ago
#7 #11
Andrew, try again please, site is working.
You add to System32\drivers\etc\hosts ?
87.239.187.146 myt.teletrade-dj.com

Original comment by ilovegir...@gmail.com on 12 Dec 2014 at 8:05

GoogleCodeExporter commented 9 years ago
I need admin permission to do this.
if only one page, can you email to me direct.

Original comment by andrewch...@chromium.org on 12 Dec 2014 at 6:29

GoogleCodeExporter commented 9 years ago
I pasted aboce, it is: http://jedwatson.github.io/react-select/

Original comment by carlosmm...@gmail.com on 12 Dec 2014 at 7:24

GoogleCodeExporter commented 9 years ago
how do you get #example > div:nth-child(1) > div:nth-child(1) > 
div:nth-child(2) ?
in page source,  I do not see it.

Original comment by andrewch...@chromium.org on 12 Dec 2014 at 7:44

GoogleCodeExporter commented 9 years ago
Andrew, try this url - http://87.239.187.146

Original comment by ilovegir...@gmail.com on 23 Dec 2014 at 1:48

GoogleCodeExporter commented 9 years ago
would you please provide the standalone HTML and other test source codes so 
that I can run locally. I can not access http://87.239.187.146.

Original comment by andrewch...@chromium.org on 23 Dec 2014 at 6:16

GoogleCodeExporter commented 9 years ago
I believe I'm experiencing a similar issue. Currently I have a control that I 
manipulate using send_keys. It works perfectly fine on Firefox driver, but when 
trying to run in Chrome I get:

Selenium::WebDriver::Error::UnknownError: unknown error: cannot focus element

To repro this issue run this ruby script 
https://gist.github.com/jmieleiii/e0e5df200ea37dbec1ec
It may need tweaking but I've run that script locally without issue.

Original comment by jmiele...@gmail.com on 3 Feb 2015 at 8:25

GoogleCodeExporter commented 9 years ago
#19 - what do you mean? - "I've run that script locally without issue."

Original comment by andrewch...@chromium.org on 4 Feb 2015 at 12:25

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
 I can reproduce your case.  we are looking into this issue.

Original comment by andrewch...@chromium.org on 4 Feb 2015 at 1:28

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
For #19 -

I have  a work around for this, please see codes below

dropdown.click
#sleep 1
#  work around
dropdown = driver.switch_to.active_element

# this throws the cannot focus element error
5.times { dropdown.send_keys(:arrow_down) }

I also ran the case in other web site with regular drop down(no CSS), and it 
work fine.  class="cc-month small" may make some difference.

Original comment by andrewch...@chromium.org on 9 Feb 2015 at 8:39

GoogleCodeExporter commented 9 years ago
This seems to be a recurring issue for chromedriver:

code.google.com/p/chromedriver/issues/detail?id=870

I'm using python and it works fine in FF and IE. 

After successfully finding the element (actually ANY element on the page), I 
can click and do other operations, but I can't "send_keys". I don't even CARE 
if the element has focus. I just want to send a SPACE or DOWN_ARROW so I can 
move down the page to get objects in view to interact with them.

Original comment by dfec...@gmail.com on 11 Feb 2015 at 4:54

GoogleCodeExporter commented 9 years ago
I ended up creating an ActionChains object, calling send_keys_to_element, and 
just passing in the element to get around it.

Original comment by dfec...@gmail.com on 11 Feb 2015 at 7:02

GoogleCodeExporter commented 9 years ago
#28 - for # 27 is a special case, and it can be worked around.

Can you create another ticket so that easier for us to track the issue?

Original comment by andrewch...@chromium.org on 11 Feb 2015 at 7:08

GoogleCodeExporter commented 9 years ago

Original comment by samu...@chromium.org on 21 Feb 2015 at 12:19