We are building and operating a test automation system for in-house system developers. (SikuliX + Testablish) Write down the technical issues and things you want to do on a daily basis.
Sikuli is fun!
As with most RPA tools, operation scenarios are closed in a single file. What is worrisome about it is that it is a pity that the image is included in the scenario. Images change with minor specification changes, so I think it's important to make the images so that they can be easily replaced. So, I tried to make it so that the image in the operation scenario of Sikuli can be pulled from the separately built Web Service.
The image file part in the operation scenario of Sikuli is pulled from Web Service.
I want to be able to reuse images by replacing images in a single scenario such as file upload, download, and Excel operation on each system.
There was one issue in implementation. That's the point that sikulix thinks it's python and needs to be implemented in jython. jython is a python language that runs on the JVM, and it seems that it sells a small amount of coding and simplicity, but I feel that the small amount of information on the WEB is a bottleneck. https://www.jython.org/
However, the new language I learn (well, it's a child of python and java) is exciting, so let's try it.
Verify with the following implementation and succeed.
----------------------- import java.net.HttpURLConnection import java.net.URL import java.io.BufferedReader import java.io.InputStreamReader import java.lang.StringBuffer import json import base64 import datetime
URL = java.net.URL url = 'RESTURL' obj = URL(url) con = obj.openConnection() con.setRequestMethod("GET") responseCode = con.getResponseCode()
BufferedReader = java.io.BufferedReader InputStreamReader = java.io.InputStreamReader
buf = BufferedReader(InputStreamReader(con.getInputStream())) response = buf.readLine() buf.close();
dir = os.getcwd()
Image is Base64 and ascii, REST return value is json file
Decode on jython
downloadData = json.loads(response) fileName = downloadData['fileName'] contentType = downloadData['contentType'] contentDataAscii = downloadData['contentData'] now = datetime.datetime.now().strftime("%Y%m%d%H%M%S") contentData = base64.b64decode(contentDataAscii) saveFileName = now + fileName saveFilePath = os.path.join(dir, saveFileName) with open(saveFilePath, 'wb') as saveFile: saveFile.write(contentData)
↓ ↓ Image recognition processing ↓ ↓ -----------------------
An image that imports the java library on python and describes java and gorigori. As long as you know the import specification format and instance creation method, the rest is smooth.
This will promote standardization of operation scenarios!
Recommended Posts