wait (...)의 모든 변형은 다음 코드에서 아래 예외를 던집니다. 내가 도대체 뭘 잘못하고있는 겁니까?driver.wait() throws IllegalMonitorStateException
java.lang.IllegalMonitorStateException
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at LoginPage.main(LoginPage.java:29)
try
{
driver.get("http://domain:port/coco/webapp/login/login.faces");
driver.findElement(By.id("clientCode")).sendKeys("coco");
driver.findElement(By.id("systemCode")).sendKeys("consumer");
driver.findElement(By.id("userId")).sendKeys("ffadmin");
driver.findElement(By.id("password")).sendKeys("password");
driver.findElement(By.className("af_commandButton")).click();
driver.wait();
Assert.assertTrue(driver.getPageSource().contains("Administration"));
}
catch (Exception e)
{
e.printStackTrace();
}
암시 적 대기를 지원하므로 seleniunm 2 이후로 기다릴 필요가 없습니다. 암시 적 대기 상태에서는 findElement 메소드 중 하나만 사용해야하며 대상 요소가 존재하지 않거나 보이지 않으면 Selenium은 그 때까지 기다립니다. 불행히도이 예제는 오래된 것입니다. 그러나 최근 예제를 살펴보면 잘 작동하는 것으로 나타납니다. http://seleniumexamples.com/blog/examples/selenium-2-examples/ –