我正在尝试运行 Eclipse java 脚本,以便使用 Appium Desktop 和 Android Emulator 自动化 Web 应用程序。
该脚本的目的只是在 Android Emulator 中打开 Chrome 浏览器并转到特定 URL:
package Appium.appiumTest;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.android.AndroidDriver;
public class chrometest {
AppiumDriver<MobileElement> driver;
public void setUp() throws MalformedURLException {
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("deviceName", "Nexus5");
capabilities.setCapability("browserName", "Chrome");
driver = new AndroidDriver<MobileElement>(new URL("https://0.0.0.0:4723/wd/hub"), capabilities);
driver.get("URL");
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
}
public void searchKeyword() {
}
public static void main(String[] args) throws MalformedURLException {
chrometest obj = new chrometest();
obj.setUp();
}
}
在 Appium 服务器运行的情况下运行应用程序时,chrome 浏览器会在模拟的 android 上打开,尽管欢迎页面不断打开。尝试三四次后,出现以下错误:
Exception in thread "main" org.openqa.selenium.WebDriverException: An
unknown server-side error occurred while processing the command. Original
error: Failed to start Chromedriver session: A new session could not be
created. (Original error: session not created exception: Chrome version must
be >= 60.0.3112.0
(Driver info: chromedriver=2.33.506120
(e3e53437346286c0bc2d2dc9aa4915ba81d9023f),platform=Windows NT 10.0.14393
x86_64)) (WARNING: The server did not provide any stacktrace information)
我曾尝试使用 Play 商店在模拟的 android 中升级 chrome 浏览器,但它不允许我登录,所以这不是一个选项。