不要追求绝对的公平,红尘之中没有公平而言,人活一世,难得糊涂。                                           it is no use doing what you like, you have got to like what you do.

测试用户名及密码的登录小程序

上一篇 / 下一篇  2007-01-05 11:42:06 / 个人分类:Robot技术

$Include "sqautil.sbh"51Testing软件测试网h+[X*@~/z4Ln
51Testing软件测试网~1j _0_3q
Sub Main
oo q }&Tj$S.\ y(^Y051Testing软件测试网xfR*\/Kn @|gd
    Dim Result As Integer51Testing软件测试网aE+E0j;f3hL
   
p.\?5s!q9?0    Dim dp_id as Long51Testing软件测试网Q4R]:K:]+?

Zt-gp4m'W0    Dim dp_Result as Long
S5PE8GT2iy%\ a\0   
o Y h(Iv[.C0    Dim strName as String
(X[g/h$~0
*V%B m#Wy^mu@Ek0    Dim strPassWord as String51Testing软件测试网p J}xK0s n

+o @8c*|0S0    'Initially Recorded: 2006-1-13  14:26:45
)Q.kQ9J)LzA$x0    'scrīpt Name: login51Testing软件测试网V*zb]\"v L/?LF
   sqalogmessage sqanone,"启动应用程序",""51Testing软件测试网n5H ]i8h3E0ME*J
   
c eW[9b)?0    StartApplication """D:\Program Files\plt\OilportSetup\oilport.exe"""51Testing软件测试网+Ra1e E7F1o-q,i9^-B
   51Testing软件测试网&d9T3hK G^
    dp_id = SQADatapoolOpen ("dp", FALSE, SQA_DP_SEQUENTIAL, FALSE)
8Be[ QU;W0   51Testing软件测试网 fiYHz+F

Q5w.t.X9F`F){0    dp_Result = SQADatapoolFetch (dp_id)
L2n|~\#y0
V&HE/l9f4|051Testing软件测试网-m Ba:HA^Bw3q#S
     while dp_Result <>  sqaDpEOF51Testing软件测试网$xQ8r r+},o
51Testing软件测试网.Pld&kn
   
R]}9y1X/q7_0           dp_Result = SQADatapoolValue (dp_id, "name", strName)
$u.})j8P4R9P5[B l0
m)gx7}(z*I7B0           dp_Result = SQADatapoolValue (dp_id, "password", strPassWord)
*s;ICW6H+_Cfa6U+x0
{-B/Q,j8Q H3c O0           dp_Result = SQADatapoolFetch (dp_id)51Testing软件测试网`.h.o{{1d&n,]ux
         
!FIDw`/{9U"e0     51Testing软件测试网(jp S2j v NS9d
    EditBox Click, "Type=Form;Name=FrmLogin;\;Type=Control;Name=txt_userName;\;Type=EditBox;Index=0", "Coords=23,2"51Testing软件测试网/v:[!]d:F*Q0|O
     '输入用户名     
b.Y {+rKE0    InputKeys strName
z,t*qz.iysn/O{0   
ci J)kiC0wX@0    EditBox Click, "Type=Form;Name=FrmLogin;\;Type=Control;Name=txt_password;\;Type=EditBox;Index=0", "Coords=49,0"51Testing软件测试网z [(Z/LTa!h
    '输入用户密码
B&g;T;Qp&U2U0    InputKeys strPassWord51Testing软件测试网O(g qHS
   
^ a C7L Rkm.E:t0    GenericObject Click, "Type=Form;Name=FrmLogin;\;Type=Control;Name=btn_login", "Coords=57,17"
F Q6M#t1Mu:L ~1v0     51Testing软件测试网q(V#k:sxw(jr
    Window SetContext, "Type=Form;Name=MainForm;VisualText=新港信息系统", ""
:@Y j4rrr'Hz0   
3`9g.c/z4^4f8o9]0    Window SetContext, "Type=Form;Name=MainForm", ""51Testing软件测试网 ]s$my8R}1k
   
TUq L*d;Ho&ee0   '验证是否成功登录51Testing软件测试网N*\~ U-f8Sw
     Result = RegionVP (CompareImage, "", "VP=Region Image;Wait=2,30;Coords=205,392,574,561")51Testing软件测试网G)t|:A$|4\H*}x
   
@Z)|&n;GO6~0    if result = 1 then
u$R^.Cj2^0   
.ui$xsy0        '如果成功登录,注销用户,清除用户名及密码,取datapool的下一条数据
e3v8A4y5S,N1vS#p0        GenericObject Click, "Type=Form;Name=MainForm;\;Type=Control;Index=8;\;Type=Control;Index=0", "Coords=24,11"51Testing软件测试网fLF,L!r7S+]B:U
   51Testing软件测试网+f,SqN'JT*c|d%t
        Window SetContext, "Class=WindowsForms.Window.808", "Activate=0"
$~"i.lG7\0        GenericObject Click, "Class=WindowsForms.Window.8;ClassIndex=1", "Coords=46,28"51Testing软件测试网 [B0V-{ k&o
   
~T FQi(y;u0        Window SetContext, "Type=Form;Name=FrmLogin", ""
4{ J:EI$q5@0        EditBox Left_Drag, "Type=Form;Name=FrmLogin;\;Type=Control;Name=txt_userName;\;Type=EditBox;Index=0", "Coords=45,9,-63,9"51Testing软件测试网#] N"Z-T {k~lQ"tp
        InputKeys "{BKSP}"51Testing软件测试网r'a7O[V%K` gA#Z k7fH5{
        EditBox Left_Drag, "Type=Form;Name=FrmLogin;\;Type=Control;Name=txt_password;\;Type=EditBox;Index=0", "Coords=47,8,-10,8"
/D7[S#h%j~3Ht0        InputKeys "{BKSP}"51Testing软件测试网VTkp;]w P
        EditBox Click, "Type=Form;Name=FrmLogin;\;Type=Control;Name=txt_userName;\;Type=EditBox;Index=0", "Coords=7,10"
$D9Q;Z-\$r+?051Testing软件测试网y D\Z*Veue0h
        sqalogmessage sqapass,"正确的用户名及密码","该用户成功登录"
C;A9L ymZ#Mx0    else
3JW9G(Z(`rA9A?6g a0        '如果用户名、密码错误,无法登录,直接清除用户名及密码,取datapool的下一条数据51Testing软件测试网$e7I!|U AE,C&U'y

y]F7A+aE0        sqalogmessage sqapass,"错误的用户名及密码","该用户不能登录"51Testing软件测试网7E5t-}.O#j*t
51Testing软件测试网%{U,q7~7Z5^\
        Window SetContext, "Type=Form;Name=FrmLogin", ""51Testing软件测试网lE/T7e,DV7l!i
        EditBox Left_Drag, "Type=Form;Name=FrmLogin;\;Type=Control;Name=txt_userName;\;Type=EditBox;Index=0", "Coords=100,9,-70,9"
w.C"P w+mrtk!rEq0        InputKeys "{BKSP}"
A/CY6F"Y&e0        EditBox Left_Drag, "Type=Form;Name=FrmLogin;\;Type=Control;Name=txt_password;\;Type=EditBox;Index=0", "Coords=100,8,-70,8"
ss'un)@0        InputKeys "{BKSP}"51Testing软件测试网I.` Haq-K[6n$H
        EditBox Click, "Type=Form;Name=FrmLogin;\;Type=Control;Name=txt_userName;\;Type=EditBox;Index=0", "Coords=7,10"51Testing软件测试网U{`#~4GPQ
   
D;xy@JR0      
+O.Il b+d#|(zX0?L0   end if
0fS*]ic0RI0n$p'W1t0   
4KN_ J-V0   wend51Testing软件测试网5\)[!qrS4A[pA

7hgJs6y J#Y(l3T0   dp_Result = SQADatapoolClose (dp_id)
k%}6op-`uPV0End Sub51Testing软件测试网1l\A$O]mB-f

X;wg6kDRRBm |!Q0//.net 开发的程序 在调试中............
}+dp?#q0

TAG: 软件测试技术 Robot技术

 

评分:0

我来说两句

Open Toolbar