Appium Inspector 抛出错误,并且具有与我能够运行 TestNG 项目相同的成功所需功能

发布于 2025-01-13 01:07:49 字数 777 浏览 2 评论 0原文

我编写了一个简单的 Java-TestNG 项目,其中所需的功能是

{
    URL url = new URL("http://127.0.0.1:4724/wd/hub");
        DesiredCapabilities caps = new DesiredCapabilities();
        caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "ANDROID");
    
        caps.setCapability("appPackage", "com.xxx.xyz");
        caps.setCapability("appActivity", "com.xxx.xyz.xyzActivity");
        driver = new AppiumDriver(url,caps);
        System.out.println("Application started");
}

但是当我在 Appium Inspector 中使用相同的功能时,

{
  "platformName": "Android",
  "appPackage": "com.xxx.xyz",
   "appActivity": "com.xxx.xyz.xyzActivity"
}

我会弹出此文本

发现无效或不受支持的 WebDriver 功能(“appPackage”, “应用程序活动”)。确保仅使用有效的 W3C WebDriver 功能

I wrote a simple Java-TestNG project in which the desired capabilities are

{
    URL url = new URL("http://127.0.0.1:4724/wd/hub");
        DesiredCapabilities caps = new DesiredCapabilities();
        caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "ANDROID");
    
        caps.setCapability("appPackage", "com.xxx.xyz");
        caps.setCapability("appActivity", "com.xxx.xyz.xyzActivity");
        driver = new AppiumDriver(url,caps);
        System.out.println("Application started");
}

But when I used the same in Appium Inspector,

{
  "platformName": "Android",
  "appPackage": "com.xxx.xyz",
   "appActivity": "com.xxx.xyz.xyzActivity"
}

I am getting pop up with this text

Invalid or unsupported WebDriver capabilities found ("appPackage", "appActivity"). Ensure to only use valid W3C WebDriver capabilities

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

酷遇一生 2025-01-20 01:07:49

当我在 Appium Inspector 中输入与 Java-TestNG 程序相同的配置时,问题得到了解决,即

{
  "platformName": "Android",
  "appPackage": "com.xxx.xyz",
   "appActivity": "com.xxx.xyz.xyzActivity"
}

Appium Inspector 开始正常工作。有些 Appium Inspector 不喜欢这个配置,

{
  "platformName": "Android",
  "appPackage": "com.xxx.xyz",
  "platformVersion": "9",
   "udid": "ce091xxx21c6c0c7e",
   "deviceName": "SM 950UI",
   "appActivity": "com.xxx.xyz.xyzActivity"
}

The problem got resolved when I entered the same configuration as in the Java-TestNG program in to Appium Inspector, which is

{
  "platformName": "Android",
  "appPackage": "com.xxx.xyz",
   "appActivity": "com.xxx.xyz.xyzActivity"
}

The Appium Inspector started working fine. Some how Appium Inspector did not like this configuration,

{
  "platformName": "Android",
  "appPackage": "com.xxx.xyz",
  "platformVersion": "9",
   "udid": "ce091xxx21c6c0c7e",
   "deviceName": "SM 950UI",
   "appActivity": "com.xxx.xyz.xyzActivity"
}
江挽川 2025-01-20 01:07:49

问题可能是您可能在没有指定远程路径的情况下启动了 appium 检查器,因此它选择了默认路径“/”
将远程路径定义为“/wd/hub”。
这个解决方案对我有用。

The issue could be you might have started the appium inspector without specifying the remote path so it is picking up the default path which is "/"
Define the remote path as "/wd/hub".
This solution worked for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文