rainmanwy / robotframework-SikuliLibrary

Sikuli Robot Framework Library provide keywords for Robot Framework to test UI through Sikuli.
Apache License 2.0
147 stars 61 forks source link

Does SikuliLibrary Support Window Server 2016 64bit? #123

Open marcuswongkl opened 4 years ago

marcuswongkl commented 4 years ago

Dear Wang Yang,

I am using Sikuli 1.1.3 with jython 2.7.1, Robot Framework 3.1.2 and jre-8u131-windows-x64 on Windows Server 2016 64bit (virtual machine).

Also using robotframework-SikuliLibrary 1.0.8 to enable the RobotFramework and Sikuli integration.

Quick question:

Does SikuliLibrary support Window Server 2016 64bit in the virtual environment?

I have been using above setup on the Windows 10 64bit machine and it works perfectly fine. But same setup doesn't seems to work on Windows Server 2016. Appreciate if you could shed some light on potential root cause or any particular workaround which could help me to move on.

FYR, exceptions encountered on the server during test execution:

Initializing test library 'SikuliLibrary' with no arguments failed: TypeError: unsupported operand type(s) for +: 'NoneType' and 'list' Traceback (most recent call last): File "C:\Test_Automation\jython2.7.1\Lib\site-packages\SikuliLibrary\sikuli.py", line 54, in init self.start_sikuli_process(port) File "C:\Test_Automation\jython2.7.1\Lib\site-packages\SikuliLibrary\sikuli.py", line 81, in start_sikuli_process self._start_sikuli_java_process() File "C:\Test_Automation\jython2.7.1\Lib\site-packages\SikuliLibrary\sikuli.py", line 81, in start_sikuli_process self._start_sikuli_java_process() File "C:\Test_Automation\jython2.7.1\Lib\site-packages\SikuliLibrary\sikuli.py", line 165, in _start_sikuli_java_process self.process.start_process(java, *arguments, shell=True, stdout=self._output_file(), File "C:\Test_Automation\jython2.7.1\Lib\site-packages\robot\libraries\Process.py", line 358, in start_process process = subprocess.Popen(command, **conf.popen_config) File "C:\Test_Automation\jython2.7.1\Lib\subprocess.py", line 859, in init self._execute_child(args, executable, preexec_fn, close_fds, File "C:\Test_Automation\jython2.7.1\Lib\subprocess.py", line 1319, in _execute_child args = _shell_command + args

rainmanwy commented 4 years ago

@marcuswongkl , could you check this link, and have a try to start SikuliLibrary java process manually.

marcuswongkl commented 4 years ago

@rainmanwy , yes, i am able to start the java process manually.

When run from RobotFramework, Sikuli process failed to start (as show in the attached screenshot) SikuliLibrary_Exception :: 14:33:30.853 | INFO | Starting process: java -jar C:\Test_Automation\jython2.7.1\Lib\site-packages\SikuliLibrary\lib\SikuliLibrary.jar 55135 C:\Test_Automation\KYC\ICN3 14:33:30.884 | FAIL | TypeError: unsupported operand type(s) for +: 'NoneType' and 'list'

What I have defined in the robot file are like below: Settings Documentation Test suite for annotate and redact document Test Setup Add Needed Image Path Resource kyc_icn3_resource.robot Library SikuliLibrary mode=NEW Suite Setup Start Sikuli Process Suite Teardown Stop Remote Server

Keywords Add Needed Image Path Add Image Path ${IMAGE_DIR}

Any suggestions to resolve above issue is much appreciated.

Regards, Marcus

rainmanwy commented 4 years ago

@marcuswongkl , when you start the process, is there any error message? And there are some log files. Could you attach the log files.

I have tried Windows Server 2012, and works fine.

BTW, how do you execute robot cases? Is it triggered background?

marcuswongkl commented 4 years ago

@rainmanwy , Hi, I am executing robot cases from the command prompt. With the path and classpath defined before the execution.

set PATH=C:\Test_Automation\lib\jre1.8.0_131\bin;C:\Test_Automation\jython2.7.1\bin;C:\Test_Automation\jython2.7.1\Lib\site-packages\selenium\webdriver; set CLASSPATH=C:\Test_Automation\lib\sikulixapi.jar;

Attached are the logs grab from the execution folder. logs.zip

This is what can be observed from the command prompt: image

I am using the same setup on Windows 10 (64bit) and it works fine.. Therefore I am puzzling and wonder what could cause the issue. Thanks for your help.

Regards, Marcus

rainmanwy commented 4 years ago

hi, @marcuswongkl , there is command in the log java -jar C:\Test_Automation\jython2.7.1\Lib\site-packages\SikuliLibrary\lib\SikuliLibrary.jar 51248 C:\Test_Automation\KYC\ICN3

you may start the process in the command-line manually, and check the error.

marcuswongkl commented 4 years ago

hi @rainmanwy , I am able to start the process successfully from the command prompt. However, there isn't additional log generated in the folder. Somehow, the Sikuli process couldn't start when it is run from the jython robot file. I am really puzzling by this different behavior between the two environments (Windows 10 vs Windows Server 2016) image

Any suggestion to drill down the issue is much appreciated.

Regards, Marcus

rainmanwy commented 4 years ago

You may execute python code like below to test it after java process is started.

from robot.libraries.Remote import Remote
r = Remote('http://127.0.0.1:51248/')
r.get_keyword_names()
r.run_keyword('add_image_path', ['d:\\'], {})
r.run_keyword('click', ['image.png'], {})

Remember to replace paramter of "add_image_path" and "click"

marcuswongkl commented 4 years ago

hi @rainmanwy , thanks for the suggestion. After installed python, the robot test scripts could start the Sikuli process and tear it down successfully.

However, when it comes to access the image from keyword: "SikuliLibrary . Wait Until Screen Contain word_content.png, ${SIKULI_TIMEOUT}", it throws "java.lang.ExceptionInInitializerError: null" but without further details.

Details as shown in below screenshot and logs. image logs.zip

I think we are getting closer to get this iron out soon. Any ideas what could cause the issue?

Btw, I managed to execute the codes suggested earlier without issue. image

Regards, Marcus

marcuswongkl commented 4 years ago

hi @rainmanwy , hope you are well.. Any comments/suggestions on how we can move forward from the above? Regards, Marcus

rainmanwy commented 4 years ago

@marcuswongkl , sorry for reply late. So you execute script in python interpreter on the windows server 2016? From the console, we could see the error is because it could not find the matched image(score is 0.6999). You could use "Set Min Similarity" keyword to configure the min matched score.

And you may check this issue for your first error.

rainmanwy commented 4 years ago

@marcuswongkl , btw, you may run robot test cases with "-L trace", there are more details in log files..