Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1828625
  • 博文数量: 283
  • 博客积分: 10141
  • 博客等级: 上将
  • 技术积分: 2931
  • 用 户 组: 普通用户
  • 注册时间: 2005-12-21 14:33
文章分类

全部博文(283)

文章存档

2013年(2)

2012年(2)

2011年(17)

2010年(36)

2009年(17)

2008年(18)

2007年(66)

2006年(105)

2005年(20)

分类: Python/Ruby

2006-09-28 13:51:40

-----------
Dogtail
-----------
1  #!/usr/bin/python
2  from dogtail.config import config
3  from dogtail import tree
4  from dogtail.utils import screenshot, run
5  import dogtail.i18n
6  dogtail.i18n.loadTranslationsFromPackageMoFiles('stardict')
7
8  from time import sleep
9  from os import environ
10 environ['LANG']='en_US.UTF-8'
11
12 run('stardict')
13 treeroot = tree.root.application('stardict')
14 treeroot.button('Clear').click()
15 sleep(1)
16
17 newtxt = treeroot.child(roleName = 'text')
18 newtxt.text = "hello"
19 sleep(1)
20
21 screenshot()
22
23 treeroot.button('go back').click()
24 sleep(1)
25
26 treeroot.button('quit').click()

-------
LDTP
-------
1  #!/usr/bin/python

3  from ldtp import *
4  from ldtputils import *

6  from time import sleep
7  from os import environ
8  environ['LANG']='en_US.UTF-8'

10 launchapp('stardict')
11 try:
12     waittillguiexist('frmStarDict')
13
14     click('frmStarDict', 'btnClear')
15     sleep(1)
16
17     enterstring('frmStarDict', 'txt0', 'hello')
18     sleep(1)
19
20     imagecapture ('StarDict', 'snapshot.png')
21
22     click('frmStarDict', 'btngoback')
23     sleep(1)   
24
25     click('frmStarDict', 'btnquit')
26 except ldtp.LdtpExecutionError, x:
27     print "LdtpExecutionError: %s"%x

 

 
 
阅读(3834) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~