原创日志转载请标明出处与连接! 大家的支持是我的动力!_______卢晨之
(luchenzhi@21cn.com/@hotmail.com)
【Python 操作IE的弹出窗口】
上一篇 /
下一篇 2010-04-01 23:48:13
/ 个人分类:Python
【Python 操作IE的弹出窗口】
3d:@,^ hl+GR4]S0作者:卢晨之
K(K%zGA2h/ViA p2W0转载请注明
D(V,][^%O0 最近和朋友在群里讨论Selenium中,源码中Pyhon关闭IE的弹出窗口失效,后来小编给了个建议是先把焦点设置给一个隐藏的层,然后发送回车的方法去实现它。感觉颇为无奈,同时也发现在PAM30中也是没有实现处理弹出窗口的问题,为此今天在PAM30的基础上新增了下面几个方法:getmsgbox、getmsgboxtext、getmsgboxtitle、closemsgbox、clickmsgboxbutton等等。主要关键点在于getmsgbox方法的实现。51Testing软件测试网-H*]!LN9iF:Ds
def getmsgbox(self, filter = None):
P*r1yF2X+`d~0""" Get the specified Popup message box
vMD wc)rs0 parameters:51Testing软件测试网i {x:`?&zvz
[filter] - Only return elements that match this filter in format
B7],}8ey*cJO0 (title=Microsoft Internet Explorer;text=Are you sure to close the window;index:=0)51Testing软件测试网s_'eC(L+w(o
The filter value to match. Regular Expressions51Testing软件测试网yn;tGM;R
can be used by starting the val with an ! "title=!Google;text=!baidu"