sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #38251
Re: [Question #294078]: robot.run with SikuliX-IDE, can't get Robot outcome.
Question #294078 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/294078
RaiMan proposed the following answer:
Ok, now I understand your problem ;-)
... and this is the solution (all in one script)
(the story behind: at the interface between the Jython and the Java
level there are still many cases, where the UTF-8 encoding is not
preserved, so at the Java level the string content is misinterpreted in
the context of UTF-16, which is the standard at the Java level)
ascript = """
robot
*** Variables ***
${USERNAME} demo
${PASSWORD} mode
${TESTSITE} http://test.sikuli.de
*** Settings ***
Library ./inline/MyLibrary
Test Setup start firefox and goto testsite ${TESTSITE}
Test Teardown stop firefox
*** Test Cases ***
正しいユーザ名とパスワードを使ってログインする
Attempt to Login with Credentials ${USERNAME} ${PASSWORD}
Status Should Be Accepted
間違ったユーザ名とパスワードを使ってログインする
Attempt to Login with Credentials betty wrong
Status Should Be Denied
"""
runScript(ucode(ascript)) # preserves the UTF encoding down to Java
# """)
class MyLibrary(object):
def start_firefox_and_goto_testsite(self, page):
popup("start_firefox_and_goto_testsite")
def stop_firefox(self):
popup("stop_firefox")
def attempt_to_login_with_credentials(self, username, password):
popup("attempt_to_login_with_credentials")
def status_should_be(self, expected):
popup("status_should_be")
------- and with the keyword library in same folder as this script:
ascript = """
robot
*** Variables ***
${USERNAME} demo
${PASSWORD} mode
${TESTSITE} http://test.sikuli.de
*** Settings ***
Library MyLibrary
Test Setup start firefox and goto testsite ${TESTSITE}
Test Teardown stop firefox
*** Test Cases ***
正しいユーザ名とパスワードを使ってログインする
Attempt to Login with Credentials ${USERNAME} ${PASSWORD}
Status Should Be Accepted
間違ったユーザ名とパスワードを使ってログインする
Attempt to Login with Credentials betty wrong
Status Should Be Denied
"""
addImportPath(getParentFolder()) # allow to find MyLibrary.py
runScript(ucode(ascript)) # preserves the UTF encoding down to Java
all the best and thanks for your contribution
I will add these examples to the docs.
--
You received this question notification because your team Sikuli Drivers
is an answer contact for Sikuli.