← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #236003]: i am not able to display the region after find failed

 

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

    Status: Answered => Open

azhar is still having a problem:
hi,

I was out of town for a while. it solved my problem partially, by taking a screenshot when failure occurs.
But when image is not found I am not able to get the screen shoe still. I mean when image is not found it goes to sikuli wrapper class and if click operation has failed then in click def it should report failure of that image with a screen shot but this is not happening. the click def is like this :

def click(self, target, modifiers=0):
      setLogEntry("CLICK: " + str(getFilename(target)))	
try:
      if isinstance(target, str) or target.__class__.__name__=="Pattern" or isinstance(target, basestring):
                        self.log.html_img("Clicking...", common.cfgImageLibrary + '/' + getFilename(target))
     else:
	if target != None:
		self.log.screenshot(msg="Click Region...", region=(target.x-100, target.y-100, 200, 200))	
     return SikuliRegion.click(self, target, modifiers)
except FindFailed, e:	
     if isinstance(target, str) or target.__class__.__name__=="Pattern" or isinstance(target, basestring):
	self.log.html_img("Find Failed", common.cfgImageLibrary + '/' + getFilename(target))
	fout = open('\\Output\\Result.doc', 'a')
	fout.write("\n")
	fout.write("Find Failed   :  FAIL")
	
   else:
          if target != None:
                     self.log.screenshot(msg="Find Region Failed", region=(target.getX()-100, target.getY()-100, 200, 200))
   self.log.screenshot(msg="Region", region=(self.getX(), self.getY(), self.getW(), self.getH()))
   raise e

I am trying to take a screenshot on find failure of image when click operation fails 
and also writing that failure into a file result.doc
both these are not working. can u please tell me the reason.
thanks in advance.

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