문제

I'm getting very unhelpful messages when it times out waiting on a condition:

Tests in error: 
    myTestName(mySuiteName): Timed out after 10 seconds waiting for              
    com.mycompany.qa.core.SeleniumWebTesting$$anon$1@6818c458

Here's the Scala code:

  def pageContains(locatorType: String, content: String) {
    locatorType match {
      case "TagName" =>
        val tag = new WebDriverWait(driver, defaultWait).until(
          new ExpectedCondition[Boolean] {
// it times out on this line below, but I can't send out any assert failure or useful message
            override def apply(driver: WebDriver) = driver.findElement(By.tagName(content)).isDisplayed
          }
        )
      case _ =>
        throw new UnsupportedOperationException("No valid locator strategy received (try a valid one, like class name)")
    }
  }
도움이 되었습니까?

해결책

You can use withMessage() method.

WebDriverWait wait = new WebDriverWait(driver, timeout);
wait.withMessage("Your desired Message");
wait.until(new ExpectedConditions(boolean));

다른 팁

If you're using scala we are having great success with http://code.google.com/p/driveby/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top