gpt4 book ai didi

java - 运行命令时遇到内部错误 : Error: Error occured while starting App

转载 作者:太空宇宙 更新时间:2023-11-04 11:19:48 25 4
gpt4 key购买 nike

问题:我的应用程序在执行 ScrollTo() 命令之前打开并关闭。

我在 Appium 上遇到此错误:

'Encountered internal error running command: Error: Error occured while starting App. Original error: com.disney.wdpro.android.mdx.activities.LoaderActivity or com.disney.mdx.wdw.google.com.disney.wdpro.android.mdx.activities.LoaderActivity never started'

Appium 日志:

[ADB] 1 device(s) connected
[ADB] Running 'C:\Users\vovan\AppData\Local\Android\sdk\platform-
tools\adb.exe' with args: ["-P",5037,"-
s","IRN7HITKLFOFVKK7","shell","am","force-stop","io.appium.unlock"]
[AndroidDriver] Not cleaning generated files. Add `clearSystemFiles`
capability if wanted.
[MJSONWP] Encountered internal error running command: Error: Error occured
while starting App. Original error:
com.disney.wdpro.android.mdx.activities.LoaderActivity

orcom.disney.mdx.wdw.google.com.android.mdx.activities.LoaderActiv
ity never started
at Object.wrappedLogger.errorAndThrow
(C:\Users\vovan\AppData\Local\Programs\appium-
desktop\resources\app\node_modules\appium\node_modules\appium-
support\lib\logging.js:63:13)
at ADB.callee$0$0$ (C:\Users\vovan\AppData\Local\Programs\appium-
desktop\resources\app\node_modules\appium\node_modules\appium-
adb\lib\tools\apk-utils.js:79:9)

Selenium 代码 Eclipse:

    public void test() throws MalformedURLException, InterruptedException {
File appDir = new File("src");
File app = new File(appDir, "com.disney.mdx.wdw.google.apk");

DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.PLATFORM_NAME,
MobilePlatform.ANDROID);
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Android Device");
cap.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, "50");
cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());

AndroidDriver driver = new AndroidDriver(new
URL("http://169.254.159.242:4723/wd/hub"), cap);
driver.scrollTo("Get Started");
TouchActions t = new TouchActions(driver);
WebElement abc =
driver.findElementById("com.disney.mdx.wdw.google:id/tutorial_button");
t.singleTap(abc).perform();

最佳答案

除了所需的功能之外,我们还需要传递“appPackage”和“appActivity”。以下是我在项目中使用的完整所需 Activity 。

        DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName","ANDROID");
capabilities.setCapability("platformVersion", "5.1");
capabilities.setCapability("platformName",Constant.appPlatform);
capabilities.setCapability("app", app.getAbsolutePath());
capabilities.setCapability("appPackage", Constant.appPackage);
capabilities.setCapability("appActivity",Constant.appActivity);

您可以从开发者或http://toolsqa.com/mobile-automation/appium/how-to-find-apppackage-and-appactivity-for-apk-file/获取appPackage和appActivity的详细信息

希望这对您有帮助。谢谢。

关于java - 运行命令时遇到内部错误 : Error: Error occured while starting App,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45049335/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com