Message5062

Author dsalagean
Recipients dsalagean
Date 2009-08-24.12:09:22
SpamBayes Score 1.32888e-12
Marked as misclassified No
Message-id <1251115765.11.0.56317255952.issue1446@psf.upfronthosting.co.za>
In-reply-to
Content
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[]
>>>
History
Date User Action Args
2009-08-24 12:09:25dsalageansetrecipients: + dsalagean
2009-08-24 12:09:25dsalageansetmessageid: <1251115765.11.0.56317255952.issue1446@psf.upfronthosting.co.za>
2009-08-24 12:09:24dsalageanlinkissue1446 messages
2009-08-24 12:09:22dsalageancreate