← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #205975]: Unable to execute simple method with (self)

 

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

    Status: Open => Answered

RaiMan proposed the following answer:
The above setup is only usable in the (MHO: useless toy - see faq 1804)
IDE's UnitTest View.

Since there is no "executable" code besides the imports, in normal run
mode, in fact nothing happens.

if you want to test this in the run mode:

def startApp(self):
    openApp("firefox.exe")
    sleep(5)

def testApp(self):
    assert exists (firefox screenshot)
    sleep(5)

startApp(None)
testApp(None)

Since in the UnitTest runtime environment, the above def()'s will be
class/object methods, they need the self as first parameter.

BTW:
with the actual Sikuli X version, this is not needed any more.
from __future__ import with_statement
from sikuli.Sikuli import *

only a 
from sikuli.Sikuli import *
is needed in imported modules that use Sikuli features.

Final recommendation:
Forget this approach and either use normal scripting or act according to the mentioned faq.

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