首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >我需要在CodeceptJS移动测试中使用Appium 2

我需要在CodeceptJS移动测试中使用Appium 2
EN

Stack Overflow用户
提问于 2022-10-26 10:49:47
回答 2查看 114关注 0票数 0

由于最新的iOS在Appum1.x上出现问题,Appium团队不再支持它,而Appium 2运行良好--我需要使用v2.

CodeceptJS 3.3.x现在正在使用Appium 1.x,由于在CodeceptJS Appium助手中默认使用'/wd/path‘,我不能将它设置为使用Appium 2。

代码语言:javascript
运行
复制
Error: Failed to create session.
The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource

Please make sure Selenium Server is running and accessible
Error: Can't connect to WebDriver.
Error: Failed to create session.
The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource

Please make sure Selenium Server is running and accessible

而Appium 2没有:

代码语言:javascript
运行
复制
[debug] [HTTP] No route found for /wd/hub/session
[HTTP] <-- POST /wd/hub/session 404 1 ms - 211

是否有办法将默认的'/wd/path‘更改为'/’?或者还有其他的帮助者或什么东西给阿比亚2?

codecept.config.js文件的一部分:

代码语言:javascript
运行
复制
        Appium: {
            host: process.env.CLOUD_HOST || 'localhost',
            port: parseInt(process.env.CLOUD_PORT) || 4723,
            app: (PLATFORM_NAME === 'iOS') ? APP_PATH_IOS || 'com.mobile.beta' : APP_PATH_ANDROID,
            desiredCapabilities: {
                platformName: process.env.PLATFORM_NAME || 'iOS',
                platformVersion: process.env.PLATFORM_VERSION || '16.0',
                automationName: process.env.AUTOMATION_NAME || 'xcuitest',
                deviceName: process.env.DEVICE_NAME || 'iPhone Xs',
                appPackage: process.env.APP_PACKAGE,
                appActivity: process.env.APP_ACTIVITY,
                xcodeOrgId: process.env.XCODE_ORG_ID,
                // udid: process.env.UDID, // used only for real iOS device

            },
        },

=========================================

  • 更新:

我使用--基路径/wd/集线器(appium -基路径/wd/集线器)启动Appium,但现在出现了另一个错误:

代码语言:javascript
运行
复制
Error: Can't connect to WebDriver.
Error: Failed to create session.
All non-standard capabilities should have a vendor prefix. The following capabilities did not have one: platformVersion,automationName,deviceName,appPackage,appActivity,xcodeOrgId,app

Please make sure Selenium Server is running and accessible

我尝试用appium:前缀更新codecept.conf.js中的codecept.conf.js,但是要么我做错了,要么它不起作用:

最新情况:

代码语言:javascript
运行
复制
        Appium: {
            host: process.env.CLOUD_HOST || 'localhost',
            port: parseInt(process.env.CLOUD_PORT) || 4723,
            app: (PLATFORM_NAME === 'iOS') ? APP_PATH_IOS || 'com.mobile.beta' : APP_PATH_ANDROID,
            desiredCapabilities: {
                'appium:platformName': process.env.PLATFORM_NAME || 'iOS',
                'appium:platformVersion': process.env.PLATFORM_VERSION || '16.0',
                'appium:automationName': process.env.AUTOMATION_NAME || 'xcuitest',
                'appium:deviceName': process.env.DEVICE_NAME || 'iPhone Xs',
                'appium:appPackage': process.env.APP_PACKAGE, // not needed for iOS
                'appium:appActivity': process.env.APP_ACTIVITY, // not needed for iOS
                'xcodeOrgId': process.env.XCODE_ORG_ID, // not needed for Android
                udid: process.env.UDID, // used only for real iOS device testing
            },
        },

错误:

代码语言:javascript
运行
复制
Error: Can't connect to WebDriver.
Error: Invalid or unsupported WebDriver capabilities found ("platformVersion", "deviceName", "appPackage", "appActivity", "xcodeOrgId", "app", "tunnelIdentifier"). Ensure to only use valid W3C WebDriver capabilities (see https://w3c.github.io/webdriver/#capabilities).If you run your tests on a remote vendor, like Sauce Labs or BrowserStack, make sure that you put them into vendor specific capabilities, e.g. "sauce:options" or "bstack:options". Please reach out to to your vendor support team if you have further questions.

Please make sure Selenium Server is running and accessible

Error#2:

代码语言:javascript
运行
复制
Error: Can't connect to WebDriver.
Error: Invalid or unsupported WebDriver capabilities found ("deviceName", "app", "tunnelIdentifier"). Ensure to only use valid W3C WebDriver capabilities (see https://w3c.github.io/webdriver/#capabilities).If you run your tests on a remote vendor, like Sauce Labs or BrowserStack, make sure that you put them into vendor specific capabilities, e.g. "sauce:options" or "bstack:options". Please reach out to to your vendor support team if you have further questions.

Please make sure Selenium Server is running and accessible
EN

回答 2

Stack Overflow用户

发布于 2022-10-26 18:17:13

如果您使用CLI启动Appium服务器,您可以使用类似于appium -p 4726 --base-path /wd/hub的东西,这将使它在旧的端点上接受请求。

更新:使用Appium 2.0,当涉及到功能时,Appium服务器将使用W3C WebDriver规范执行严格的可压缩性。他们可以找到这里。您为Appium提供的其他任何东西都应该有appium:前缀(比如appium:platformVersionappium:appPackage等等)。

票数 0
EN

Stack Overflow用户

发布于 2022-11-08 11:46:25

这很可能是CodeceptJS的Appium助手中的一个问题,需要进行更新,以遵循Appium更严格的W3C WebDriver规范。

更新需要对前缀的支持,如:

代码语言:javascript
运行
复制
...
appium:platformName: 'iOS'
appium:automationName: 'xcuitest'
...

代码语言:javascript
运行
复制
...
browserstack:platformName: 'Android'
saucelabs:automationName: 'uiautomator2'
...

目前,我们不能用前缀来配置变量。

我也不知道如何与CodeceptJS维护人员联系进行此更新。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/74206545

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档