使用selenium测试showModalDialog模态对话框

上一篇 / 下一篇  2012-05-14 18:22:44 / 个人分类:Selenium

 
http://www.iteye.com/topic/434092

TAG:

MillionRoses 引用 删除 dian106106   /   2012-05-14 23:59:30
package ENSG;

import com.thoughtworks.selenium.SeleneseTestCase;

public class dhptest extends SeleneseTestCase {
        public void dhpjunit1() throws Exception {       
               
        selenium.open("http://xin.msn.com/?lang=en-sg");
        String overrideShowModalDialogJs="if(selenium.browserbot.getCurrentWindow().showModalDialog){";

        overrideShowModalDialogJs += "selenium.browserbot.getCurrentWindow().showModalDialog = function( sURL, vArguments, sFeatures)";  
               
        overrideShowModalDialogJs +="selenium.browserbot.getCurrentWindow().open(sURL, 'modal', sFeatures);";  
               
        overrideShowModalDialogJs += "};}";  
        //showModalDialog方法进行覆盖  
        selenium.getEval(overrideShowModalDialogJs);  
        selenium.click("link=Make MSN my homepage");  
        selenium.openWindow("","modal");  
        selenium.waitForPopUp("modal","15000");  
        selenium.selectWindow("name=modal");  
       
}
}
MillionRoses 引用 删除 dian106106   /   2012-05-14 21:16:10
模态对话框  
模态对话框(Modal Dialogue Box,又叫做模式对话框),是指在用户想要对对话框以外的应用程序进行操作时,必须首先对该对话框进行响应。如单击【确定】或【取消】按钮等将该对话框关闭。
MillionRoses 引用 删除 dian106106   /   2012-05-14 18:25:19
selenium 中文论坛的帖子
MillionRoses 引用 删除 dian106106   /   2012-05-14 18:24:44
http://seleniumcn.cn/read.php?tid=907
 

评分:0

我来说两句

日历

« 2024-05-09  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 74540
  • 日志数: 80
  • 建立时间: 2012-04-12
  • 更新时间: 2013-05-21

RSS订阅

Open Toolbar