1

我目前在使用 java 等待库时遇到了一个奇怪的问题。我正在使用等待等待一分钟并使用以下语句检查一个条件。

 String currentTime = getAvailableDriveTime();
await("Wait for time")
    .atMost(60, TimeUnit.SECONDS)
    .until(this::getDriveTime, not(currentTime));
 public String getDriveTime() {
        String driveTime = appiumDriver.getPageSource();
        driveTime = driveTime.split("CurrentTimeString\":\"")[1];
        return  driveTime.split("\",\"ArcColor\"")[0];
    }

奇怪的是,上述语句适用于示例 Appium 测试脚本,但同样不适用于 cucumber+Appium+ java 框架并引发以下错误。

java.lang.NoSuchMethodError: org.hamcrest.Matcher.describeMismatch(Ljava/lang/Object;Lorg/hamcrest/Description;)
    at org.awaitility.core.AbstractHamcrestCondition.getMismatchMessage(AbstractHamcrestCondition.java:76)
    at org.awaitility.core.AbstractHamcrestCondition.access$300(AbstractHamcrestCondition.java:25)
    at org.awaitility.core.AbstractHamcrestCondition$1.eval(AbstractHamcrestCondition.java:55)
    at org.awaitility.core.ConditionAwaiter$ConditionPoller.call(ConditionAwaiter.java:190)
    at org.awaitility.core.ConditionAwaiter$ConditionPoller.call(ConditionAwaiter.java:177)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
    at ✽.Driving time in the driving overview screen will be updated(file:src/main/resources/EFSFeatureFiles/HOS&DVIR/VehicleMotionFeature/EFSVehicleMotion_DriverLoggedIn.feature:83)
4

0 回答 0