问题:我的应用程序在ScrollTo()
命令执行之前打开并关闭。
我在Appium上遇到了这个错误:
'遇到内部错误运行命令:错误:发生错误 同时启动App。原始错误: com.disney.wdpro.android.mdx.activities.LoaderActivity或 com.disney.mdx.wdw.google.com.disney.wdpro.android.mdx.activities.LoaderActivity 从未开始'
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 Code 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();
答案 0 :(得分:0)
除了所需的功能外,我们还需要传递" appPackage"和" appActivity"。以下是我在项目中使用的完整所需活动。
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的详细信息希望这会对你有所帮助。感谢。
答案 1 :(得分:0)
获取应用激活和应用套餐名称的另一种方法是输入:' adb logcat'在命令提示符下。
此时,应该在连接的设备中打开应用程序。将生成日志,并从那里获取所需的应用程序详细信息。