【发布时间】:2016-06-25 10:19:27
【问题描述】:
场景是,我想用python处理机器人框架中弹出的IE。为了处理弹出窗口,我使用了 AutoIT SendKeys、shell 脚本、pywinauto TypeKeys。 该代码在本地计算机上运行时可以正常工作,但是当我通过代理计算机上的团队城市运行脚本时,它会失败。 我的观察是,在代理机器中,代码无法处理弹出的窗口。
经过分析,我发现这是因为代理机器在通过团队城市运行脚本时处于锁定系统状态。
代码:
def fhandle_savepopup(self):
shell = win32com.client.Dispatch("WScript.Shell")
seleniumLib = BuiltIn().get_library_instance('Selenium2Library')
shell.AppActivate ("Internet Explorer")
sleep(2)
autolib = BuiltIn().get_library_instance('AutoItLibrary')
shell.SendKeys('{F6}')
sleep(3)
shell.SendKeys('{TAB}')
sleep(3)
shell.SendKeys('{ENTER}')
我也使用了 AutoIT 和 pywinauto 库。但没有运气。
请帮我找到解决办法。
【问题讨论】:
标签: python selenium robotframework pywinauto