论坛首页 编程语言技术论坛

[sikuli]-python脚本的一个简单例子

浏览 5548 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (1)
作者 正文
   发表时间:2011-10-31  
def setUp(self):
  openApp("/Applications/jEdit.app")
  wait([img=http://sikuli.org/examples/TestJEdit.sikuli/1251934858090.png][/img], 20000)
  close = ()
#  if find(close):
#    click(close)

def tearDown(self):
  closeApp("jEdit.app")
  untilNotExist(, 20000)


def test_textarea_add_del_by_key(self):
  type("hello world") 
  assertExist() 
  type("a",KEY_CTRL) 
  type("\n") 
  assertNotExist()

def test_textarea_add_del_by_menu(self):
  type("hello world") 
  assertExist() 
  click() 
  click() 
  type("\n")
  assertNotExist()

def test_new_tab_by_key(self):
  type("n",KEY_CTRL) 
  assertExist(Pattern().similar(0.95)) 

def test_new_tab_by_menu(self):
  click()
  click()
  assertExist(Pattern().similar(0.95)) 

def test_new_tab_by_toolbar(self):
  click()
  assertExist(Pattern().similar(0.95)) 


def _verify_find(self):
  sleep(0.5)
  type("hello") 
  type("\n")
  click(Pattern().similar(0.90)) 
  assertExist(Pattern().similar(0.94)) 
  type("\b")
  assertExist()


def test_find_by_key(self):
  type("a long hello world\n") 
  type("f",KEY_CTRL) 
  self._verify_find()

def test_find_by_menu(self):
  type("a long hello world\n") 
  click()
  click()
  self._verify_find()

def test_find_by_toolbar(self):
  type("a long hello world\n") 
  click() 
  self._verify_find()


def test_textfield_on_toolbar(self):
  type("a long hello world\n") 
  assertExist() 
  type("f",KEY_CTRL) 
  assertExist(Pattern().similar(0.85))
  type("hello") 
  assertExist() 



def test_toolbar_print_dialog(self):
  click() 
  assertExist() 
  click() 


def test_menu_submenu(self):
  click() 
  click() 
  assertExist() 
  type("test") 
  click() 
  click() 
  click() 
  click() 
  click() 
  click()
  assertExist()

def test_scrollbar(self):
  for i in range(1,50):
    type("line %d\n" % i)
  tail = Pattern().similar(0.92)
  wait(tail, 10000)
  assertExist(tail)
  thumb_at_top = Pattern().similar(0.98)
  assertNotExist(thumb_at_top)
  dragDrop(, [0, -1000])
  assertExist(thumb_at_top)
  assertNotExist(tail)
  assertExist(Pattern().similar(0.92))
  dragDrop(Pattern().similar(0.90), [0, 1000])
  assertExist(tail)

def test_quit(self):
  type("test") 
  type("e",KEY_CTRL) 
  type("q",KEY_CTRL) 
  click() 
  assertExist(Pattern().similar(0.90)) 
论坛首页 编程语言技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics