Python论坛  - 讨论区

标题:[python-chinese] python-chinese Digest, Vol 28, Issue 147

2007年01月09日 星期二 15:23

lith tuhua.li在gmail.com
星期二 一月 9 15:23:52 HKT 2007

On 4/20/06, python-chinese-request at lists.python.cn
<python-chinese-request at lists.python.cn> wrote:
> Send python-chinese mailing list submissions to
>         python-chinese at lists.python.cn
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         http://python.cn/mailman/listinfo/python-chinese
> or, via email, send a message with subject or body 'help' to
>         python-chinese-request at lists.python.cn
>
> You can reach the person managing the list at
>         python-chinese-owner at lists.python.cn
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of python-chinese digest..."
>
>
> Today's Topics:
>
>    1. (no subject) (pythonmailist)
>    2. Re: ???pamie???????????????? (tocer)
>    3. Re: ???pamie???????????????? (xianglong yin)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 20 Apr 2006 11:30:34 +0800
> From: "pythonmailist" <pythonmailist at 126.com>
> Subject: [python-chinese] (no subject)
> To: "python-chinese" <python-chinese at lists.python.cn>
> Message-ID: <200604201130337348104 at 126.com>
> Content-Type: text/plain;       charset="gb2312"
>
>
>
>
> --------------
> pythonmailist
> 2006-04-20
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: Thu, 20 Apr 2006 12:22:23 +0800
> From: tocer <tocer.deng at gmail.com>
> Subject: Re: [python-chinese] ???pamie????????????????
> To: python-chinese at lists.python.cn
> Message-ID:
>         <d5ea6e840604192122g26cfbb46q73106391918e1e23 at mail.gmail.com>
> Content-Type: text/plain; charset="gb2312"
>
> 用附件中的文件覆盖原文件。下面是测试程序
>
> 网页文件(1.html):
> 
> >
> > from pamie20 import cPAMIE, cModalPopUp, winGuiAuto > import time > > ie = cPAMIE.PAMIE() > wga = winGuiAuto > # 登录 > ie.navigate("c:\\1.html") > clickCancel = cModalPopUp.handlePopup("Confirm","取消") > clickCancel.setPopupName("选择文件") //设置弹出窗体的标题 > clickCancel.start() //启动新的进程 > ie.buttonClick("install") > time.sleep(1) > clickCancel.join() //进程结束 > > 原模块把popupname写死了,在非英语系统中,就会发生找不到窗口的问题。 > 你要感谢我的话,帮我给原作者写封信吧,请他改正这个问题。 > > 在 06-4-20,xianglong yin<yinxianglong at gmail.com> 写道: > > > > 可以给我一些范例代码吗?因为我用pamie2.0包里面的buildCert.py文件做测试,它里面就用线程实现的,但是依然不能识别中文的"确认"按钮。 > > 谢谢tocer大哥 > > > > > > > > 在06-4-19,tocer <tocer.deng at gmail.com> 写道: > > > 问题的原因是: > > > 执行到 ie.buttonClick("install") > > > 这一句的时候,程序停下来等待客户确认,不再往下执行,也就是说查找窗口的语句根本没有执行到。 > > > > > > 解决的方法,用线程去执行 ie.buttonClick("install") 试试 > > > > > > 在 06-4-19,xianglong yin<yinxianglong at gmail.com> 写道: > > > > > > > > 对啊,内部网页。这个内部的网页是需要安装证书这些,很麻烦的。 > > > > > > > > 但是我在用pamie测试文件浏览对话框时也不能找到, > > > > 例如: > > > > 网页文件(1.html): > > > >
> > > > > > > >
> > > > python代码如下: > > > > import cPAMIE, winGuiAuto > > > > > > > > ie = cPAMIE.PAMIE() > > > > wga = winGuiAuto > > > > # 登录 > > > > ie.navigate("d:\\1.html") > > > > ie.buttonClick("install") > > > > #点击上面的按钮"install"之后,有一个"文件选择"的对话框弹出来,就需要控制对话框上的控件了 > > > > # 通过winGuiAuto查找窗口,但是每次都是下面这句话报错。 > > > > hwnd = wga.findTopWindow(wantedText="选择文件") > > > > # 点击取消按钮 > > > > cancelButton = wga.findControl(hwnd, wantedClass="Button", > > > > wantedText="取消") > > > > clickButton(cancelButton ) > > > > > > > > 这段python代码不能找到 "选择文件"的对话框。 > > > > > > > > > > > > 在06-4-19,tocer <tocer.deng at gmail.com> 写道: > > > > > 从程序上看不出什么错误,你那个网页是内部网页么?有没有相似的网站,我上去试试? > > > > > > > > > > 在 06-4-19,xianglong yin< yinxianglong at gmail.com> 写道: > > > > > > > > > > > > 我的代码是这样的 > > > > > > import cPAMIE, winGuiAuto > > > > > > > > > > > > ie = cPAMIE.PAMIE () > > > > > > wga = winGuiAuto > > > > > > # 登录 > > > > > > ie.navigate(" http://192.168.28.130:10003/exp") > > > > > > ie.textBoxSet ("{actionForm.userName }", "0102") > > > > > > ie.textBoxSet("{actionForm.userPwd}", "01020000") > > > > > > ie.textBoxSet ("{actionForm.instCode}", "01020000") > > > > > > #点击下面按钮"I1"之后,有一个"证书选择"的对话框弹出来,就需要点击对话框上的确定 > > > > > > ie.buttonClick("I1") > > > > > > # 通过winGuiAuto查找窗口,但是每次都是下面这句话报错。 > > > > > > hwnd = wga.findTopWindow(wantedText="证书选择")# > > > > > > okButton = wga.findControl(hwnd, wantedClass="Button", > > > > wantedText="确定") > > > > > > clickButton(okButton) > > > > > > > > > > > > 请帮我找找问题,多谢各位! > > > > > > > > > > > > > > > > > > > > > > > > 在06-4-18,tocer <tocer.deng at gmail.com> 写道: > > > > > > > 代码贴出来看看 > > > > > > > > > > > > > > 在 06-4-17,xianglong yin< yinxianglong at gmail.com > 写道: > > > > > > > > > > > > > > > > > > > > > > > > 我在用pamie做网页表单测试的时候,遇到了需要处理弹出对话框,比如 > > > > > > > > "证书选择"、"选择文件"、"保存文件"的对话框。 > > > > > > > > 我根据网上的一些资料采用winGuiAuto的方法 > > > > > > > > findTopWindow(wantedText="证书选择")来处理,老是失败。 > > > > > > > > 而且我也采用转码的方式: > > > > > > > > findTopWindow(wantedText=u"证书选择") > > > > > > > > > > > > > > > > findTopWindow(wantedText=r"证书选择") > > > > > > > > > > > > > > > > > > findTopWindow(wantedText=unicode("证书选择","cp936")) > > > > > > > > 等等转码方式都试过了,依然不能 通过findTopWindow来找到弹出窗口。 > > > > > > > > > > > > > > > > 希望大家能给予我帮助,感激不尽!! > > > > > > > > _______________________________________________ > > > > > > > > python-chinese > > > > > > > > Post: send python-chinese at lists.python.cn > > > > > > > > Subscribe: send subscribe to > > > > > > > > python-chinese-request at lists.python.cn > > > > > > > > Unsubscribe: send unsubscribe to > > > > > > > > python-chinese-request at lists.python.cn > > > > > > > > Detail Info: > > > > > > > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > > python-chinese > > > > > > > Post: send python-chinese at lists.python.cn > > > > > > > Subscribe: send subscribe to > > > > > > python-chinese-request at lists.python.cn > > > > > > > Unsubscribe: send unsubscribe to > > > > > > python-chinese-request at lists.python.cn > > > > > > > Detail Info: > > > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > python-chinese > > > > > > Post: send python-chinese at lists.python.cn > > > > > > Subscribe: send subscribe to > > > > > > python-chinese-request at lists.python.cn > > > > > > Unsubscribe: send unsubscribe to > > > > > > python-chinese-request at lists.python.cn > > > > > > Detail Info: > > > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > python-chinese > > > > > Post: send python-chinese at lists.python.cn > > > > > Subscribe: send subscribe to > > > > python-chinese-request at lists.python.cn > > > > > Unsubscribe: send unsubscribe to > > > > python-chinese-request at lists.python.cn > > > > > Detail Info: > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > python-chinese > > > > Post: send python-chinese at lists.python.cn > > > > Subscribe: send subscribe to > > > > python-chinese-request at lists.python.cn > > > > Unsubscribe: send unsubscribe to > > > > python-chinese-request at lists.python.cn > > > > Detail Info: > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > _______________________________________________ > > > python-chinese > > > Post: send python-chinese at lists.python.cn > > > Subscribe: send subscribe to > > python-chinese-request at lists.python.cn > > > Unsubscribe: send unsubscribe to > > python-chinese-request at lists.python.cn > > > Detail Info: > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to > > python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to > > python-chinese-request at lists.python.cn > > Detail Info: > > http://python.cn/mailman/listinfo/python-chinese > > > > > -------------- next part -------------- > """ > cModalPopUp.py > Revised: Jan 9th 2006 > Developer: plhdpk > Description: Class to handle pop up windows > > Licence: GNU General Public License (GPL) > This software is provided 'as-is', without any express or implied warranty. > In no event will the authors be held liable for any damages arising from the use of this software. > > Permission is granted to anyone to use this software for any purpose, > including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: > > 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. > If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. > 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. > 3. This notice may not be removed or altered from any source distribution. > """ > > import cPAMIE > import winGuiAuto > import win32gui > import time > import os, sys > import warnings > import threading > import traceback > import pprint > > warnings.filterwarnings("ignore") > > class handlePopup(threading.Thread): > """ Construct a popup handler thread. > parameters: > type - The type of popup to expect. > *args - One or more arguments to handle the popup, usually just a > control name such as 'OK' or 'Cancel' works but sometimes a > file name or string is needed as well. > """ > > showDebugging = False # Show debug print lines? > > def __init__(self, type, *args): > threading.Thread.__init__(self); > self.wga = winGuiAuto; > self.wn = win32gui; > self.popupType = type; > if type == 'ChooseFile': > self.command = self.enterTextAndClickControl; > self.popupName = 'Choose File'; > self.args = args; > elif type == 'Alert': > self.command = self.clickControl; > self.popupName = 'Microsoft Internet Explorer'; > self.args = args; > elif type == 'Confirm': > self.command = self.clickControl; > self.popupName = 'Microsoft Internet Explorer'; > self.args = args; > elif type == 'Prompt': > self.command = self.enterTextAndClickControl; > self.popupName = 'Explorer User Prompt'; > self.args = args; > else: > self.command = self.clickControl; > self.popupName = 'Microsoft Internet Explorer' > self.args = 'Cancel;' > > def run(self): > """ Override Threading's run() method. Finds the dialog and calls > the required command with the arguments supplied in the constructor. > TODO: Need to find an exit strategy if the dialog is not found. > parameters: > None > returns: > Nothing > """ > count = 10 > while(count 0): > time.sleep(1); > try: > hwnd = self.wn.FindWindow("#32770", self.popupName) > try: > apply(self.command, (hwnd, self.args,)) > time.sleep(1) > return > except: > if self.showDebugging: > (ErrorType,ErrorValue,ErrorTB)=sys.exc_info() > print sys.exc_info() > traceback.print_exc(ErrorTB) > except: > pass > count -= 1; > return > > def enterTextAndClickControl(self, hwnd, args): > """ Used for file choosers or prompt dialogs that enter text into a text box. > parameters: > hwnd: - The handle to the dialog. > args[0] - The text to set in the text box in the dialog. > args[1] - The button control name. > returns: > Nothing > """ > text=args[0]; > control=args[1]; > if self.showDebugging: > print "Text and Control is: %s %s" %(text, control) > x = self.wga.dumpWindow(hwnd) # dump out all the controls > pprint.pprint(x) # print out all the controls > inputBox = self.wga.findControl(hwnd, > wantedClass="Edit") > self.wga.setEditText(inputBox, text) > time.sleep(.5) > buttons = self.wga.findControls(hwnd, > wantedClass="Button", > wantedText=control) > for b in buttons: > self.wga.clickButton(b) > > def clickControl(self, hwnd, args): > """ Used for simple dialogs that just have buttons such as 'ok', 'cancel' > or 'clear'. > parameters: > hwnd: - The handle to the dialog. > args[0] - The button control name. > returns: > Nothing > """ > controlText = args[0]; > if self.showDebugging: > x = self.wga.dumpWindow(hwnd) # dump out all the controls > pprint.pprint(x) # print out all the controls > button = self.wga.findControl(hwnd, > wantedClass="Button", > wantedText=controlText) > self.wga.clickButton(button) > > # add by tocer 2006-04-19 > def setPopupName(self, name): > self.popupName = name > > > > > > ------------------------------ > > Message: 3 > Date: Thu, 20 Apr 2006 13:35:50 +0800 > From: "xianglong yin" <yinxianglong at gmail.com> > Subject: Re: [python-chinese] ???pamie???????????????? > To: python-chinese at lists.python.cn > Message-ID: > <977252d80604192235wffd7df4vdfff19e0ec21f203 at mail.gmail.com> > Content-Type: text/plain; charset="gb2312" > > 哈哈,tocer的确太棒了! > > 我刚刚测试已经不出现异常了, > 如果我python自动点击对话框上面的"取消"按钮, > 我加了行代码 > clickCancel.clickControl(clickCancel,"取消") > 但是运行起来没有反应啊(也就是 python程序没有去点击取消按钮), > > 我应该怎么做呢? > 多谢tocer大哥啦 > > > > > > 在06-4-20,tocer <tocer.deng at gmail.com> 写道: > > > > 用附件中的文件覆盖原文件。下面是测试程序 > > > > 网页文件(1.html): > >
> > > >
> > > > from pamie20 import cPAMIE, cModalPopUp, winGuiAuto > > import time > > > > ie = cPAMIE.PAMIE() > > wga = winGuiAuto > > # 登录 > > ie.navigate("c:\\1.html") > > clickCancel = cModalPopUp.handlePopup("Confirm","取消") > > clickCancel.setPopupName("选择文件") //设置弹出窗体的标题 > > clickCancel.start() //启动新的进程 > > ie.buttonClick("install") > > time.sleep(1) > > clickCancel.join() //进程结束 > > > > 原模块把popupname写死了,在非英语系统中,就会发生找不到窗口的问题。 > > 你要感谢我的话,帮我给原作者写封信吧,请他改正这个问题。 > > > > 在 06-4-20,xianglong yin<yinxianglong at gmail.com> 写道: > > > > > > > > 可以给我一些范例代码吗?因为我用pamie2.0包里面的buildCert.py文件做测试,它里面就用线程实现的,但是依然不能识别中文的"确认"按钮。 > > > 谢谢tocer大哥 > > > > > > > > > > > > 在06-4-19,tocer <tocer.deng at gmail.com> 写道: > > > > 问题的原因是: > > > > 执行到 ie.buttonClick("install") > > > > 这一句的时候,程序停下来等待客户确认,不再往下执行,也就是说查找窗口的语句根本没有执行到。 > > > > > > > > 解决的方法,用线程去执行 ie.buttonClick("install") 试试 > > > > > > > > 在 06-4-19,xianglong yin<yinxianglong at gmail.com> 写道: > > > > > > > > > > 对啊,内部网页。这个内部的网页是需要安装证书这些,很麻烦的。 > > > > > > > > > > 但是我在用pamie测试文件浏览对话框时也不能找到, > > > > > 例如: > > > > > 网页文件(1.html): > > > > >
> > name="installForm"> > > > > > > > > > >
> > > > > python代码如下: > > > > > import cPAMIE, winGuiAuto > > > > > > > > > > ie = cPAMIE.PAMIE() > > > > > wga = winGuiAuto > > > > > # 登录 > > > > > ie.navigate("d:\\1.html") > > > > > ie.buttonClick("install") > > > > > #点击上面的按钮"install"之后,有一个"文件选择"的对话框弹出来,就需要控制对话框上的控件了 > > > > > # 通过winGuiAuto查找窗口,但是每次都是下面这句话报错。 > > > > > hwnd = wga.findTopWindow(wantedText="选择文件") > > > > > # 点击取消按钮 > > > > > cancelButton = wga.findControl(hwnd, wantedClass="Button", > > > > > wantedText="取消") > > > > > clickButton(cancelButton ) > > > > > > > > > > 这段python代码不能找到 "选择文件"的对话框。 > > > > > > > > > > > > > > > 在06-4-19,tocer <tocer.deng at gmail.com> 写道: > > > > > > 从程序上看不出什么错误,你那个网页是内部网页么?有没有相似的网站,我上去试试? > > > > > > > > > > > > 在 06-4-19,xianglong yin< yinxianglong at gmail.com> 写道: > > > > > > > > > > > > > > 我的代码是这样的 > > > > > > > import cPAMIE, winGuiAuto > > > > > > > > > > > > > > ie = cPAMIE.PAMIE () > > > > > > > wga = winGuiAuto > > > > > > > # 登录 > > > > > > > ie.navigate(" http://192.168.28.130:10003/exp") > > > > > > > ie.textBoxSet ("{actionForm.userName }", "0102") > > > > > > > ie.textBoxSet("{actionForm.userPwd}", "01020000") > > > > > > > ie.textBoxSet ("{actionForm.instCode}", "01020000") > > > > > > > #点击下面按钮"I1"之后,有一个"证书选择"的对话框弹出来,就需要点击对话框上的确定 > > > > > > > ie.buttonClick("I1") > > > > > > > # 通过winGuiAuto查找窗口,但是每次都是下面这句话报错。 > > > > > > > hwnd = wga.findTopWindow(wantedText="证书选择")# > > > > > > > okButton = wga.findControl(hwnd, wantedClass="Button", > > > > > wantedText="确定") > > > > > > > clickButton(okButton) > > > > > > > > > > > > > > 请帮我找找问题,多谢各位! > > > > > > > > > > > > > > > > > > > > > > > > > > > > 在06-4-18,tocer <tocer.deng at gmail.com> 写道: > > > > > > > > 代码贴出来看看 > > > > > > > > > > > > > > > > 在 06-4-17,xianglong yin< yinxianglong at gmail.com > 写道: > > > > > > > > > > > > > > > > > > > > > > > > > > > 我在用pamie做网页表单测试的时候,遇到了需要处理弹出对话框,比如 > > > > > > > > > "证书选择"、"选择文件"、"保存文件"的对话框。 > > > > > > > > > 我根据网上的一些资料采用winGuiAuto的方法 > > > > > > > > > findTopWindow(wantedText="证书选择")来处理,老是失败。 > > > > > > > > > 而且我也采用转码的方式: > > > > > > > > > findTopWindow(wantedText=u"证书选择") > > > > > > > > > > > > > > > > > > findTopWindow(wantedText=r"证书选择") > > > > > > > > > > > > > > > > > > > > > findTopWindow(wantedText=unicode("证书选择","cp936")) > > > > > > > > > 等等转码方式都试过了,依然不能 通过findTopWindow来找到弹出窗口。 > > > > > > > > > > > > > > > > > > 希望大家能给予我帮助,感激不尽!! > > > > > > > > > _______________________________________________ > > > > > > > > > python-chinese > > > > > > > > > Post: send python-chinese at lists.python.cn > > > > > > > > > Subscribe: send subscribe to > > > > > > > > > python-chinese-request at lists.python.cn > > > > > > > > > Unsubscribe: send unsubscribe to > > > > > > > > > python-chinese-request at lists.python.cn > > > > > > > > > Detail Info: > > > > > > > > > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > > > python-chinese > > > > > > > > Post: send python-chinese at lists.python.cn > > > > > > > > Subscribe: send subscribe to > > > > > > > python-chinese-request at lists.python.cn > > > > > > > > Unsubscribe: send unsubscribe to > > > > > > > python-chinese-request at lists.python.cn > > > > > > > > Detail Info: > > > > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > > python-chinese > > > > > > > Post: send python-chinese at lists.python.cn > > > > > > > Subscribe: send subscribe to > > > > > > > python-chinese-request at lists.python.cn > > > > > > > Unsubscribe: send unsubscribe to > > > > > > > python-chinese-request at lists.python.cn > > > > > > > Detail Info: > > > > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > > python-chinese > > > > > > Post: send python-chinese at lists.python.cn > > > > > > Subscribe: send subscribe to > > > > > python-chinese-request at lists.python.cn > > > > > > Unsubscribe: send unsubscribe to > > > > > python-chinese-request at lists.python.cn > > > > > > Detail Info: > > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > > python-chinese > > > > > Post: send python-chinese at lists.python.cn > > > > > Subscribe: send subscribe to > > > > > python-chinese-request at lists.python.cn > > > > > Unsubscribe: send unsubscribe to > > > > > python-chinese-request at lists.python.cn > > > > > Detail Info: > > > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > > > > > _______________________________________________ > > > > python-chinese > > > > Post: send python-chinese at lists.python.cn > > > > Subscribe: send subscribe to > > > python-chinese-request at lists.python.cn > > > > Unsubscribe: send unsubscribe to > > > python-chinese-request at lists.python.cn > > > > Detail Info: > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > > > > > > > > _______________________________________________ > > > python-chinese > > > Post: send python-chinese at lists.python.cn > > > Subscribe: send subscribe to > > > python-chinese-request at lists.python.cn > > > Unsubscribe: send unsubscribe to > > > python-chinese-request at lists.python.cn > > > Detail Info: > > > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese at lists.python.cn > > Subscribe: send subscribe to python-chinese-request at lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060420/587b9042/attachment.html > > ------------------------------ > > _______________________________________________ > python-chinese mailing list > python-chinese at lists.python.cn > http://python.cn/mailman/listinfo/python-chinese > > End of python-chinese Digest, Vol 28, Issue 147 > *********************************************** >

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号