← Back to team overview

sikuli-driver team mailing list archive

[Question #269211]: how to input Chinese characters in Sikuli

 

New question #269211 on Sikuli:
https://answers.launchpad.net/sikuli/+question/269211

i am using Sikulix 1.1.0 nightly built around 6.25. 2015 on win7 64 bit and JDK1.8, Robotframework 2.8.7, Python2.7.10, Jython2.5.4RC1 

I want to input Chinese characters in one textbox and then click search in the head of the box. 
in the scripts,  I use following to explicitly saying i am using utf-8 and we are using type(unicode(s,"utf-8"))
as Railman suggested in 2013 posts. But i still get the following errors.  IllegalArgumentException: Cannot convert character 上 


# -*- coding: utf-8 -*-
from __future__ import with_statement
from sikuliwrapper import *
addImagePath(common.cfgImageLibrary)

class Wechat(BaseLogger):
	ROBOT_LIBRARY_SCOPE = 'TEST SUITE'

	def __init__(self):
		self.appCoordinates = (0, 0, 1024, 768)
		
	def startwechat(self):
			print 'This is continuing to work'


	def searchPublic(self):
		click("cross.png")
		wait(5)
		click("addfriends.png")
		wait(5)
		click("addnewfriend.png")
		s="上海睿博研发"
		type(unicode(s,"utf-8"))
	


22:15:17.616 INFO [log] CLICK on L(396,137)@S(0)[0,0 1366x768]
[log] CLICK on L(328,216)@S(0)[0,0 1366x768]
[log] CLICK on L(259,191)@S(0)[0,0 1366x768]
[log]  TYPE "上海睿博研发" 
 

22:15:17.675 FAIL IllegalArgumentException: Cannot convert character 上 
 

22:15:17.679 DEBUG java.lang.IllegalArgumentException: 
	at org.sikuli.script.Key.toJavaKeyCode(Key.java:692)
	at org.sikuli.script.RobotDesktop.typeChar(RobotDesktop.java:359)
	at org.sikuli.script.Region.keyin(Region.java:4177)
	at org.sikuli.script.Region.type(Region.java:4045)
	at Wechat$py.searchPublic$4(E:\wechatbackup\Wechat\Wechat.sikuli\Wechat.py:79)
	at Wechat$py.call_function(E:\wechatbackup\Wechat\Wechat.sikuli\Wechat.py)
	at robot.model.testcase$py.visit$7(C:\Python27\Lib\site-packages\robot\model\testcase.py:64)
 


-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.