FuckTheWorld / chromedriver

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

python selenium chrome yields wrong keys on send_keys #1137

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I've been running some tests on a remote ubuntu machine and i found a weird bug.
If i try to send any of these keys '%/?^56' to an input, using send_keys, they 
don't get there.

5 creates a backspace
6 creates a Shift+Tab
^ creates a Tab
% creates a backspace
? creates a Enter
Software versions are:

Selenium is 2.46.0
Chrome is 43.0.2357.81 Ubuntu 14.04 (64-bit)
ChromeDriver is 2.15.322488
I'm running all of this in a tightvncserver, with fluxbox. Same thing on 
Firefox works ok.

I later upgraded Chrome to 44.0 and Chromedriver to 2.16, but the issue still 
persists in some way. The list of wrongly printed keys gets reduced to '%/?5'. 
How can i investigate this further? I've turned on logging to DEBUG level, and 
everything seems ok.

https://github.com/SeleniumHQ/selenium/issues/707#issuecomment-114980969
https://stackoverflow.com/questions/31029571/python-selenium-send-keys-yields-wr
ong-character?noredirect=1#comment50085971_31029571

Original issue reported on code.google.com by TheStick...@gmail.com on 24 Jun 2015 at 7:56

GoogleCodeExporter commented 9 years ago
https://code.google.com/p/chromedriver/issues/detail?id=861&q=send_keys&colspec=
ID%20Status%20Pri%20Owner%20Summary
this might be related

Original comment by TheStick...@gmail.com on 24 Jun 2015 at 7:56

GoogleCodeExporter commented 9 years ago
TheStick613@

thanks for filing bug, I have tried this issue in:- 
OS:- Ubuntu 14.04, language en-US
chromeDriver:- 2.16
Chrome Browser:- version:- 43.0.2357.130
Selenium:- 2.46

And NOT able to reproduce the issue. please let us know if this is what you 
were trying when you faced this issue ? what is locale language/keyboard 
configuration in your OS where this issue reproduces ? 

----we did ------steps-----
run- java -jar selenium-server-standalone-2.46.0.jar -role hub
run- java -jar selenium-server-standalone-2.46.0.jar 
-Dwebdriver.chrome.driver=chromedriver216 -role node -hub 
http://localhost:4444/grid/register
both are running in same Ubuntu machine.

---------------test case -------------
from selenium import webdriver

driver = webdriver.Remote("http://localhost:4444/wd/hub", 
webdriver.DesiredCapabilities.CHROME)
driver.get("file:///usr/local/google/home/agautam/Documents/SampleHTML/form2.htm
l")
driver.find_element_by_name('firstname').send_keys('%/?^56')

Original comment by agau...@chromium.org on 2 Jul 2015 at 8:26

GoogleCodeExporter commented 9 years ago
I've further done these steps:

chromedriver --verbose --verbose &> fulllog.txt
This started a server on localhost port 9515

Then in python:
import selenium
from selenium import webdriver
driver = webdriver.Remote("http://localhost:9515", 
desired_capabilities=selenium.webdriver.common.desired_capabilities.DesiredCapab
ilities.CHROME)
driver.get.("http://google.ro")
elem = driver.find_element_by_id('lst-ib')
elem.send_keys('5)

The relevant part in fulllog.txt:

[29.377][INFO]: COMMAND TypeElement {
   "id": "0.5080867761280388-1",
   "sessionId": "3f79fdc929325a57178e4ad648feb3ab",
   "value": [ "5" ]
}
[29.378][INFO]: Waiting for pending navigations...
[29.378][INFO]: Done waiting for pending navigations
[29.378][DEBUG]: DEVTOOLS COMMAND Runtime.evaluate (id=13) {
   "expression": "(function() { // Copyright (c) 2012 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n/**\n * Enum f...",
   "returnByValue": true
}
[29.386][DEBUG]: DEVTOOLS RESPONSE Runtime.evaluate (id=13) {
   "result": {
      "type": "object",
      "value": {
         "status": 0,
         "value": "INPUT"
      }
   },
   "wasThrown": false
}
[29.386][DEBUG]: DEVTOOLS COMMAND Runtime.evaluate (id=14) {
   "expression": "(function() { // Copyright (c) 2012 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n/**\n * Enum f...",
   "returnByValue": true
}
[29.392][DEBUG]: DEVTOOLS RESPONSE Runtime.evaluate (id=14) {
   "result": {
      "type": "object",
      "value": {
         "status": 0,
         "value": "text"
      }
   },
   "wasThrown": false
}
[29.393][DEBUG]: DEVTOOLS COMMAND Runtime.evaluate (id=15) {
   "expression": "(function() { // Copyright (c) 2012 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n/**\n * Enum f...",
   "returnByValue": true
}
[29.403][DEBUG]: DEVTOOLS RESPONSE Runtime.evaluate (id=15) {
   "result": {
      "type": "object",
      "value": {
         "status": 0,
         "value": true
      }
   },
   "wasThrown": false
}
[29.404][DEBUG]: DEVTOOLS COMMAND Runtime.evaluate (id=16) {
   "expression": "(function() { // Copyright (c) 2012 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n/**\n * Enum f...",
   "returnByValue": true
}
[29.407][DEBUG]: DEVTOOLS RESPONSE Runtime.evaluate (id=16) {
   "result": {
      "type": "object",
      "value": {
         "status": 0,
         "value": true
      }
   },
   "wasThrown": false
}
[29.407][DEBUG]: DEVTOOLS COMMAND Runtime.evaluate (id=17) {
   "expression": "(function() { // Copyright (c) 2012 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n/**\n * Enum f...",
   "returnByValue": true
}
[29.409][DEBUG]: DEVTOOLS RESPONSE Runtime.evaluate (id=17) {
   "result": {
      "type": "object",
      "value": {
         "status": 0,
         "value": null
      }
   },
   "wasThrown": false
}
[29.411][DEBUG]: DEVTOOLS COMMAND Input.dispatchKeyEvent (id=18) {
   "modifiers": 0,
   "nativeVirtualKeyCode": 8,
   "text": "",
   "type": "rawKeyDown",
   "unmodifiedText": "",
   "windowsVirtualKeyCode": 8
}
[29.411][DEBUG]: DEVTOOLS RESPONSE Input.dispatchKeyEvent (id=18) {

}
[29.411][DEBUG]: DEVTOOLS COMMAND Input.dispatchKeyEvent (id=19) {
   "modifiers": 0,
   "nativeVirtualKeyCode": 0,
   "text": "5",
   "type": "char",
   "unmodifiedText": "5",
   "windowsVirtualKeyCode": 0
}
[29.411][DEBUG]: DEVTOOLS RESPONSE Input.dispatchKeyEvent (id=19) {

}
[29.411][DEBUG]: DEVTOOLS COMMAND Input.dispatchKeyEvent (id=20) {
   "modifiers": 0,
   "nativeVirtualKeyCode": 8,
   "text": "",
   "type": "keyUp",
   "unmodifiedText": "",
   "windowsVirtualKeyCode": 8
}
[29.412][DEBUG]: DEVTOOLS RESPONSE Input.dispatchKeyEvent (id=20) {

}
[29.412][INFO]: Waiting for pending navigations...
[29.412][INFO]: Done waiting for pending navigations
[29.412][INFO]: RESPONSE TypeElement

It looks like it receives a '5' but it somehow gets translated into virtual key 
code 8, which represents a BACKSPACE. Locale is 
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

Original comment by TheStick...@gmail.com on 2 Jul 2015 at 9:09

GoogleCodeExporter commented 9 years ago
I've also found this, which is similar. I also use a mac.
https://code.google.com/p/chromedriver/issues/detail?id=1037

Original comment by TheStick...@gmail.com on 2 Jul 2015 at 9:11