NoSuchWindowException:没有这样的窗口:目标窗口已经关闭

时间:2016-06-02 15:56:59

标签: java selenium

I am running a test using selenium WebDriver and getting following error:

org.openqa.selenium.NoSuchWindowException: no such window: target window already closed
from unknown error: web view not found
  (Session info: chrome=50.0.2661.102)

我写的代码是:

@Test
public void LogIn_Page() throws InterruptedException {

    driver.get(config.getApplicationUrl());

    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

    System.out.println("========== Login Test Start =========");

    login.loginAction("username", "password");
}


public class LogIn_Page {

    static WebDriver driver;

    @FindBy(how = How.CLASS_NAME, using = "button-login")
    public WebElement buttonLogin;

    @FindBy(how = How.CSS, using = "input[class='is-text']")
    public WebElement userName;

    @FindBy(how = How.NAME, using = "j_password")
    public WebElement passWord;

    @FindBy(how = How.CSS, using = "button[class='login__button']")
    public WebElement submit;

    @FindBy(how = How.ID, using = "login-popup")
    public WebElement loginPop;

    public LogIn_Page(WebDriver driver) {

        this.driver = driver;
    }

    public void loginAction(String UserName, String PassWord) {

        buttonLogin.click();
        userName.sendKeys(UserName);
        passWord.sendKeys(PassWord);
        submit.click();
    }
}

我想做的测试:

  • 按下用于创建登录弹出窗口的登录按钮
  • 输入电子邮件,密码
  • 按登录。

出现弹出窗口,但未写入电子邮件和密码的值(附加例外)

0 个答案:

没有答案