webDriver를 (Guice를 사용하여) 정의한 기본 클래스가 있습니다. 이것은 내 beforeclass 코드의 아래 라인과 함께 정의하고있다해당 요소가 없습니다. 요소 : webdriver에서 예외를 찾을 수 없습니다.
@Inject
protected Provider<WebDriver> webDriverProvider;
protected static WebDriver webDriver;
내가 beforesuite 후에 실행됩니다 다른 클래스를했고 그것이 내가 주어진 함수 내 테스트를 작성한 방법 항목이 있습니다. . 그리고 여기이
public void method1() throws InterruptedException {
Thread.sleep(3000);
log.info("Navigating to Method1");
webDriver.findElement(By.xpath(Element1)).click();
}
문제 같은 것이 선
webDriver.findElement (By.xpath (Element1이가))) (클릭하면 외모;
은 내가 org.openqa.selenium.NoSuchElementException 같은 예외 메시지가 실행되지 않습니다 : 이러한 요소 :
XPath는이 올바른지 : 요소를 찾을 수 없습니다입니다. 내 beforesuite의 일부인이 방법 전에 대화 상자를했습니다
I 시도 클릭 문 위에 다음 행을 추가 :
webDriver.switchTo().defaultContent();
log.info (webDriver.findElement (By.xpath (Element1이)) .getAttribute (Element1)); webDriver.findElement (By.xpath (Element1)). isDisplayed();
문제는 "webDriver는"이 모든 포인터가 더 그것을 디버깅 나에게 도움이 될 예외 : NoSuchElementException
같은 예외가 발생 위치한 첫 번째 인스턴스입니다.
감사합니다.
클래스 2에서 class1을 확장했습니다. – Prabhath
답변을 따르십시오. http://stackoverflow.com/questions/39190910/nosuchelementexception-unable-to-locate- element/39191349 # 39191349 –
Saurabh : iframe에 없으며 문제를 해결하지 못했지만 10 초를 기다렸습니다. – Prabhath