有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java对于一个Appium项目,我得到以下错误“构造函数URL(字符串)引用了缺少的类型MalformedURLException”

我有一个appium代码,如下所示,其中我声明了所需的功能和Android驱动程序

但我得到了一个错误:

"The constructor URL(String) refers to the missing type MalformedURLException" in the line : driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), cap);

这是以前的工作,所以我知道我错删除了一些东西,但不知道它是什么以及如何添加回来

有人能帮我吗

代码:

FileReader reader=new FileReader(System.getProperty("user.dir")+"\\global.properties"); 
    Properties prop = new Properties();
    prop.load(reader);
    AndroidDriver<AndroidElement> driver;
    DesiredCapabilities cap=new DesiredCapabilities();
    cap.setCapability("VERSION", prop.get("version")); 
    cap.setCapability("deviceName", prop.get("deviceName"));
    cap.setCapability("platformName","Android");
    cap.setCapability("udid", prop.get("udid"));
    cap.setCapability("appPackage", prop.get("AppPackage"));      
    cap.setCapability("appActivity",prop.get("AppActivity")); 
    driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), cap);

共 (0) 个答案