【问题标题】:WaitforElement timeout error?WaitforElement 超时错误?
【发布时间】:2011-09-29 17:04:21
【问题描述】:

我正在将我的编码转换为 Junit4(webdriver) 。当我在 Eclipse 中运行我的代码时,下面的代码中出现错误,

for (int second = 0;; second++) {
  if (second >= 60) fail("timeout");
     try { 
       if (isElementPresent(By.cssSelector("button.MB_focusable"))) break;
     }
     catch (Exception e) {}
     Thread.sleep(1000);
    }

谁能告诉我如何摆脱这个?

【问题讨论】:

  • 什么样的错误?编译错误?您是否只是超时失败?
  • Thread.sleep(1000) 行应该有错误为:Unhandled exception type InterruptedException

标签: java selenium junit4 selenium-ide


【解决方案1】:

在创建DefaultSelenium 对象后尝试调用isElementPresent 方法。

在 Eclipse 和 Selenium Rc 中运行测试用例时,我们需要调用对象的对象。

如果遇到任何其他问题,请尝试告诉我。

【讨论】:

    猜你喜欢
    • 2020-01-01
    • 2010-12-15
    • 2010-12-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-02
    • 2023-03-10
    相关资源
    最近更新 更多