Selenium RC java异常问题

时间:2011-07-07 11:20:03

标签: java exception selenium-rc

我使用Selenium jar文件在eclipse中创建了一个java项目。 在使用JUnit测试运行时,我收到了Java Exception错误:

package com.example.tests;

import com.thoughtworks.selenium。*;

import java.util.ArrayList; import java.util.HashMap; import com.infy.csvUtil.CSVFileReader;

公共类创建扩展SeleneseTestCase {     public void setUp()throws Exception {         setUp(“http://14.126.220.15:84333/”,“* firefox”);     }

public void Creationv2() throws Exception {

    try {
        selenium.open("CCC/CEP?REQUEST=SIGNONREQ");
    } catch (Exception e) {
        e.printStackTrace();
    }
    selenium.selectWindow(null);
    assertEquals("Selected panel window", selenium.getTitle());
    selenium.type("SignonUserName", "sssss");
    selenium.type("SignonPassword", "fewere");
    selenium.click("button1");
    if (selenium.isAlertPresent()) {
        selenium.getAlert();
    }

运行时出现以下错误:

* * Java.lang.Assertionexception:预期“选定的面板窗口”,但是看到了“”。

1 个答案:

答案 0 :(得分:0)

以下陈述的断言失败。

 assertEquals("Selected panel window", selenium.getTitle());

尝试使用以下语句打印标题并确认它是否与预期标题匹配(即“选定的面板窗口”)

System.out.println("Title -> "+selenium.getTitle());