有错误的代码:
package TestCase;
import java.net.MalformedURLException;
import java.net.URI;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import com.gargoylesoftware.htmlunit.javascript.host.URL;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.remote.MobileCapabilityType;
import io.appium.java_client.remote.MobilePlatform;
public class TestWebBrowser {
//AppiumDriver driver = new IOSDriver();
public static AndroidDriver driver;
public static void main(String[] args) throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
}
}
消息错误是:
- The constructor URL(string) is undefined
- The constructor AndroidDriver(URL, DesiredCapabilities) is undefined
- AndroidDriver is a raw type
我尝试了不同版本的 java-client,但问题仍然存在
最佳答案
您需要使用像这样的现有构造函数:
https://appium.github.io/java-client/io/appium/java_client/android/AndroidDriver.html
您需要使用java.net.URL
而不是com.gargoylesoftware.htmlunit.javascript.host.URL
关于java - 在 eclipse 中找不到带有 Appium 的构造函数 AndroidDriver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56401779/