簡體   English   中英

為什么滑動不適用於 Android [React-Native] 上的 appium?

[英]Why swipe doesn't work with appium on Android[React-Native]?

我正在嘗試按坐標(x / y)滑動我在appium webite上找到了這個方法,但它對我不起作用並顯示這個錯誤: TypeError: Cannot read property 'performTouchAction' of undefined

這是我的測試代碼:

jasmine.DEFAULT_TIMEOUT_INTERVAL = 80000;
const driver = wd.promiseChainRemote('localhost', appiumPORT);

beforeAll(async () => {
    await driver.init(appiumConfigAndroidNoReset);
    await driver.setImplicitWaitTimeout(timeToWaitForElement);
});

test('TCWSF3-uitwoering', async () => {
    try {
        await driver.sleep(15000);

        let action = new wd.TouchAction();
        action.press({x: 600, y: 500});
        action.wait({ms: 500});
        action.moveTo({x: 600, y: 1900});
        action.release();
        await action.perform();
        
    } catch(err) {
        console.log(err);
    }
}); 

這是我的 appium 配置:

platformName: 'Android',
deviceName: 'Pixel 3a',
app: '/Users/test/Desktop/APP/mobile/android/app/build/outputs/apk/app-debug.apk',
platformVersion: '11.0',
appActivity: 'fb.test.MainActivity',
appPackage: 'fb.test.test',
noReset: true, 
fullReset: false,
clearSystemFiles: true,
automationName: 'uiautomator2',
newCommandTimeout: 500,

我找到了這樣的解決方案:

      let action = new wd.TouchAction(driver);
      action.press({x: 300, y: 1600})
            .wait(500)
            .moveTo({x: 300, y: 300})
            .release()
            .perform()

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM