2014-06-18 1 views

답변

0

이것은 테스트 픽스처 코드가 설계되고 구조화되는 방법에 따라 다릅니다. try/catch 블록 안에 FindElement 코드를 래핑 할 수 있습니다. 다음과 같음 :

Public void TestMethod(string elementId) 
{ 
    try 
    { 
    driver.FindElement(By.CssSelector(elementId)); 
    } 
    catch(NoSuchElementException exception) 
    { 
    Assert.Fail("Can't find the element in the page. The element is: " +elementId) 
    } 
}