原创日志转载请标明出处与连接! 大家的支持是我的动力!_______卢晨之 (luchenzhi@21cn.com/@hotmail.com)

【PAM30 源码修改_02】

上一篇 / 下一篇  2009-06-16 22:54:20 / 个人分类:Python

VtIm+|&?F0注:作者 卢晨之,转载请注明。 源码修改目的出于学习非商业用途,修改日期:2009-6-16 。MSN:luchenzhi@hotmali.com

ub+I/Yq0

,\Nm!p,s)d+z0需要覆盖原来PAM30文件,删除PAM30.pyc文件

@l)}Hv$`+t K"R0

kYB/h2aG01,修改的方法:51Testing软件测试网x(hr3KslkA@

51Testing软件测试网Yj$i.biN4F%@

1),getFrame方法修改添加了通过id与title的识别,让Frame获取更为方便,不仅仅通过name参数

GBgW2z,WU051Testing软件测试网!~:[ b3Pl8DH#E

def getFrame(self, name=None,id=None,title=None):
%Q6WX)w0@1W9mh9k%yx-L0        """ Gets a a frame51Testing软件测试网p;{!M7IW+Z`*c5k#s)dc
            parameters:51Testing软件测试网k0F)u4PH
                name  - The name or index of the frame51Testing软件测试网(I#P1~,XO5OYS+]
                id    - The id of the frame    #(amend by luchenzhi @ Jun 16,2009)
sh"jM8T0                title - The title of frame     #(amend by luchenzhi @ Jun 16,2009)51Testing软件测试网R1~E$dR-SN2V ?
            returns:
Q8K#b8cX O0                a frame. element
tls3V/mW0        """51Testing软件测试网;Y7N-u#?*`.q2e
        self._wait()
S|%dKm:z0        frames = self._ie.Document.frames
h-p4eN{)cP@0        if name:51Testing软件测试网){hk9ZA`-w+`-p
            try:                                #(amend by luchenzhi @ Jun 14,2009)51Testing软件测试网 kxX9} `tx%bno
                destFrames = name.split(".")
p!d.{6]1uM%B0            except:
1Z/{l*_"X4X:W)[(@0                print()
|R.h yXo`I+K0            if isinstance(name, int):51Testing软件测试网U~g| TmB {Dd
                return frames[name]
YeA2C1ytR7v0            else:
_*s+]9j7F;o)~ sn0                j = 0
#wLYge2T0                for destFrame. in destFrames:51Testing软件测试网S7bO;k,W%pT4J`
                    j += 1
9G/l3tHt'w^0                    for i in range(frames.length):
7I6Apg zf%IUI0                        fName = frames[i].name51Testing软件测试网/q!C2\~J0^ES
                        if fName == destFrame.:
5s)qw}EK0                            if j == len(destFrames):
$G {SurZ0Wh0                                myFrame. = frames[i]51Testing软件测试网GN pa$n8y'N
                                self._frameWait(myFrame)
^Ev%wC6~8Y0                                return myFrame
&b2j*F_-v` E0                            else:51Testing软件测试网8l8CPo0S;_3IFR\"h7y
                                frames = frames[i].document.frames51Testing软件测试网N'OQx Yz-{~
                return None51Testing软件测试网.U2K&t-?VtT/x
        elif id:                              #(amend by luchenzhi @ Jun 16,2009) 51Testing软件测试网$R;U6Yj`HM:w
            try:51Testing软件测试网F U;X\y_?U
                return self._ie.Document.getElementById(id)
da0K)R7Q.ML0            except:
9Q-^;l],b.l6bK0                print("The Frame. Object can't be found")51Testing软件测试网r#qQx%ZV G^
                return None51Testing软件测试网N"lc,yR3{-@o6v$iI x
           51Testing软件测试网'o*Gv;c4xsq7o2m
        elif title:                          #(amend by luchenzhi @ Jun 16,2009)51Testing软件测试网]3IO?!nC
            for frame. in frames:51Testing软件测试网 ?;F][EvB;A2G
                try :
w/a x j6Lr0                    frametitle=frame.Document.title
Mz4R3B_0                except:51Testing软件测试网$B"Sw%G!nn}
                    pass51Testing软件测试网 i1I)R5H(]!d ^ f
                if title==frametitle:51Testing软件测试网C.sc;[v uY6H
                    return frame
\NPA9d0            return None51Testing软件测试网di1R BE_(A W#[
        else:
.i0W4L1ryDgO\0            return None

Te~a+x^H2?Y(n)J&e0

TAG:

 

评分:0

我来说两句

Open Toolbar