我需要一些帮助我的下面的内容。每次运行这个项目时我都会出错。它启动cmd但无法运行测试。
package Automation;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.Test;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.remote.MobilePlatform;
public class FirstAppiumTest {
@Test
public void startappium () throws IOException, InterruptedException
{
Runtime.getRuntime().exec ("cmd /c start C:\\startappium.bat");
Thread.sleep(7000L);
File appDir=new File("src");
File app = new File(appDir,"app.apk");
DesiredCapabilities cap=new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.PLATFORM_NAME,MobilePlatform.ANDROID);
cap.setCapability(MobileCapabilityType.DEVICE_NAME,"Android Emulator");
cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 100);
cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
AndroidDriver driver = new AndroidDriver (new URL ("http://127.0.0.1:4723/wd/hub"),cap);
driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS);
}
}
以下是以下错误。
失败:startappium java.lang.NoSuchMethodError:com.google.common.collect.ImmutableSet.toImmutableSet()Ljava / util / stream / Collector; at org.openqa.selenium.remote.ProtocolHandshake.streamW3CProtocolParameters(ProtocolHandshake.java:238)
=============================================== 默认测试 测试运行:1,失败:1,跳过:0
感谢您的及时回复。谢谢