Issue1446

classification
Title: 1st arg can't be coerced to java.lang.CharSequence[] even when using workaround
Type: behaviour Severity: major
Components: None Versions: 2.5.0
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: dsalagean, fwierzbicki, pjenvey
Priority: Keywords:

Created on 2009-08-24.12:09:25 by dsalagean, last changed 2009-08-26.04:30:47 by pjenvey.

Messages
msg5062 (view) Author: Dan Salagean (dsalagean) Date: 2009-08-24.12:09:22
Environment:
Windows XP SP3, JRE 1.6.0_16, jython 2.5.0

If the java method receives a java.lang.CharSequence parameter, it is 
not coerced by the Jython. 
As a workaround you could use java.lang.String, but it does not work. 
See the example below, using WebDriver 
(http://code.google.com/p/webdriver/).

D:\webDriver>set CLASSPATH=d:\webDriver\json-
20080701.jar;d:\webDriver\junit-3.8.1.jar;d:\webDriver\webdriver-all.jar

D:\webDriver>jython
*sys-package-mgr*: processing new jar, 'C:\jython2.5.0\jython.jar'
*sys-package-mgr*: processing new jar, 'D:\webDriver\json-20080701.jar'
*sys-package-mgr*: processing new jar, 'D:\webDriver\junit-3.8.1.jar'
*sys-package-mgr*: processing new jar, 'D:\webDriver\webdriver-all.jar'
*sys-package-mgr*: processing new jar, 'C:\JRE1.6\lib\resources.jar'
*sys-package-mgr*: processing new jar, 'C:\JRE1.6\lib\rt.jar'
*sys-package-mgr*: processing new jar, 'C:\JRE1.6\lib\jsse.jar'
*sys-package-mgr*: processing new jar, 'C:\JRE1.6\lib\jce.jar'
*sys-package-mgr*: processing new jar, 'C:\JRE1.6\lib\charsets.jar'
*sys-package-mgr*: processing new jar, 'C:\JRE1.6\lib\ext\dnsns.jar'
*sys-package-mgr*: processing new jar, 'C:\JRE1.6
\lib\ext\localedata.jar'
*sys-package-mgr*: processing new jar, 'C:\JRE1.6
\lib\ext\sunjce_provider.jar'
*sys-package-mgr*: processing new jar, 'C:\JRE1.6\lib\ext\sunmscapi.jar'
*sys-package-mgr*: processing new jar, 'C:\JRE1.6\lib\ext\sunpkcs11.jar'
Jython 2.5.0 (Release_2_5_0:6476, Jun 16 2009, 13:33:26)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_16
Type "help", "copyright", "credits" or "license" for more information.
>>> from org.openqa.selenium.firefox import FirefoxDriver
>>> from org.openqa.selenium import By
>>> from java.lang import String
>>>
>>> driver = FirefoxDriver()
>>> driver.get("http://www.google.com")
>>> driver.findElement(By.name("q")).sendKeys( String( "myvalue" ) )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: sendKeys(): 1st arg can't be coerced to 
java.lang.CharSequence[]
>>>
msg5067 (view) Author: Philip Jenvey (pjenvey) Date: 2009-08-26.04:30:46
This is asking for an array of CharSequences, not a CharSequence. Try:

sendKeys(["myvalue"])
History
Date User Action Args
2009-08-26 04:30:47pjenveysetstatus: open -> closed
resolution: invalid
messages: + msg5067
nosy: + pjenvey
2009-08-25 15:10:42fwierzbickisetnosy: + fwierzbicki
2009-08-24 12:09:25dsalageancreate