简体   繁体   English

如何使用PAMIE访问弹出窗口

[英]How to access pop-up window with PAMIE

I want to know how to change windows using PAMIE . 我想知道如何使用PAMIE更改窗口。 I am using this to log on to a website with a password, and then click through some links and screens. 我使用它来使用密码登录网站,然后单击某些链接和屏幕。 After I log in the next screen is a new window and can't get to that window. 我登录后的下一个屏幕是一个新窗口,无法进入该窗口。

from PAM30 import PAMIE
ie1 = PAMIE()

website = "my website"
ie1.navigate(website)
ie1.setTextBox("username", "my username")
ie1.setTextBox("password", "my password")
ie1.clickButton("btnSubmit")
ie1.clickLink("EREP")
ie1.changeWindow("new window name") 
ie1 = None

I get the following error: 我收到以下错误:

Traceback (most recent call last):
File "C:/Python32/test3", line 13, in <module>
  ie1.changeWindow("new window name")
File "C:\Python32\lib\site-packages\PAM30.py", line 197, in changeWindow
  newWin = self.windowFind(wintext)
AttributeError: 'PAMIE' object has no attribute 'windowFind'

I dont know about PAMIE, but I have done something like what you describe with IEC . 我不了解PAMIE,但我做过类似您在IEC中描述的事情。

This snippet opens an url, clicks a link to open a popup and the graps that popup to do some stuff. 该代码段打开一个URL,单击一个链接以打开一个弹出窗口,然后单击该弹出窗口以执行某些操作。 After that the popup is closed. 之后,弹出窗口关闭。

ie = IEC.IEController()
ie.Navigate(url)
ie.PollWhileBusy()

while True:

    time.sleep(sleeptime)
    ie.ClickLink("show Fullscreen")
    ie.PollWhileBusy()
    popup = IEC.IEController(window_url='jpg')
    img =  popup.GetCurrentUrl()
    # ... do some stuff
    popup.CloseWindow()
    ie.ClickLink('Next Image ')

It might be a place to start if you are not tied to PAMIE. 如果您不依赖PAMIE,则可能是一个起点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM