← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #268529]: where is sikuli-script.jar equivalent when integrating with Robotframework, Selenium

 

Question #268529 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/268529

peter huang gave more information on the question:
what is the getlocation() here? is anything wrong?

the programme i want to run with Jython is as following:

import sys
import org.sikuli.basics.SikulixForJython
# from sikuli.Sikuli import *
from robotremoteserver import RobotRemoteServer
from org.sikuli.script import *

class SikuliRemoteLibrary:

	def __init__(self):
		self.SS = Screen()
		self.PT = Pattern()

	def _wait(self, imgFile, timeOut, similarity):
		try:
			self.PT = Pattern(imgFile)
			self.PT = self.PT.similar(float(similarity))
			self.SS.wait(self.PT, float(timeOut))
		except FindFailed, err:
			print "ERR: _wait"
			raise AssertionError(err)

	def click_object(self, imgFile, timeOut, similarity):
		try:
			self._wait(imgFile, timeOut, similarity)
			self.SS.click(imgFile)
		except FindFailed, err:
			raise AssertionError("Cannot click [" + imgFile + "]")

	def object_exists(self, imgFile, similarity, timeOut):
		try:
			self._wait(imgFile, timeOut, similarity)
		except FindFailed, err:
			raise AssertionError("Could not find [" + imgFile + "]")

	def type_at_object(self, imgFile, txt, timeOut, similarity):
		try:
			self._wait(imgFile, timeOut, similarity)
			self.SS.type(imgFile, txt)
		except FindFailed, err:
			raise AssertionError("Cannot type at [" + imgFile + "]")

	def paste_at_object(self, imgFile, txt, timeOut, similarity):
		try:
			self._wait(imgFile, timeOut, similarity)
			self.SS.paste(imgFile, txt)
		except FindFailed, err:
			raise AssertionError("Cannot paste at [" + imgFile + "]")

if __name__ == '__main__':
	SRL = SikuliRemoteLibrary()
	RobotRemoteServer(SRL, *sys.argv[1:])

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