0
Eclipse에서 Selenium WebDriver를 사용합니다.페이지 제목을 올바르게 확인 하시겠습니까?
제목이 올바르게 표시되는지 확인하는 방법을 씁니다.
class Check {
String text_to_found;
String reason;
Check (String t, String r) {
text_to_found=t;
reason=r;
}
public void check_title() {
try {
Assert.assertTrue("Title " + text_to_found + " not found", text_to_found.equals(reason));
} catch (AssertionError e) {
System.err.println("title not found: " + e.getMessage());
}
}
나는 그런 명령을 호출 : 그것은 올바른 작동
Check title1 = new Check ("Title", driver.getTitle());
title1.check_title();
처음 여기에 코드입니다. 그러나 두 번째 (그리고 계속) 번,이 메서드를 호출하면 (새 윈도우가 열렸을 때) 제목이 발견되지 않는다고하지만 정확한지는 알 수 있습니다. 조언, 코드에 어떤 문제가 있습니까?