2011-04-02 82 views
1

我试图抓取弹出窗口的源html(使用waitForPopUp和getHtmlSource);然而,硒并没有等待弹出窗口完全加载目标内容,因此我得到了获取内容的调用代码(请让我知道实际的术语是什么)。Selenium waitforpopup在页面完全加载前执行

有人能告诉我哪个硒函数可以用来让脚本等待目标加载之前抓取源?

谢谢。

回答

2

clickAndWaitwaitForPageToLoadopen只是您可用于等待主页面完全加载的几个函数示例。他们阻止,所以之后立即致电waitForPopUp

+0

我应该为我的弹出窗口指定一个目标,还是硒知道它是弹出窗口?我会使用什么样的目标? – newB 2011-04-02 18:07:25

0

您需要指定窗口ID并超时。硒IDE -

waitForPopUp(windowID, timeout) 
Arguments: 

    * windowID - the JavaScript window "name" of the window that will appear (not the text of the title bar) If unspecified, or specified as "null", this command will wait for the first non-top window to appear (don't rely on this if you are working with multiple popups simultaneously). 
    * timeout - a timeout in milliseconds, after which the action will return with an error. If this value is not specified, the default Selenium timeout will be used. See the setTimeout() command. 

Waits for a popup window to appear and load up. 

的B/W做你支持51区硒提案 - http://area51.stackexchange.com/proposals/4693/selenium 该提案是由SeleniumHQ支持,我们需要更多的用户来遵守它,让它见光的日子。

0

直接导致弹出窗口出现的命令(通常为click)运行selectPopUpAndWait

相关问题