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();
}
}
我想做的测试:
出现弹出窗口,但未写入电子邮件和密码的值(附加例外)