Error 405 when trying to run a simple swipe test

The requested command matched a known URL but did not match any method for that URL.

image

Hello guys.

I have a problem in a test swipe for App Android, always what run this test, is return that error: “ERROR webdriver: Request failed with status 405 due to unknown method: Not implemented”. And I’ve already been in some forums and nothing. Please, can someone help me?

My capabilities:

"default-capabilities": {
            "platformName": "Android",
            "appium:platformVersion": "13",
            "appium:deviceName": "AppiumAVD",
            "appium:deviceOrientation": "portrait",
            "appium:automationName": "UiAutomator2",
            "appium:appPackage": "com.wdiodemoapp",
            "appium:appActivity": "com.wdiodemoapp.MainActivity"
          },

Versions:

  • Node: 18.0.0
  • Appium: 2.2.1
  • WebdriverIo: 8.21.0

Language:

  • JavaScript

Code:

it('Should be able to swipe horizontally', async () => {
        // Elemento alvo para verificar após o swipe
        const targetElement = await $('//android.widget.TextView[@text="GREAT COMMUNITY"]');

        // Obtenha a posição inicial e final para o swipe
        const startX = 0.8; // Porcentagem da largura da tela
        const endX = 0.2; // Porcentagem da largura da tela
        const y = 0.5; // Porcentagem da altura da tela

        const { height, width } = await driver.getWindowSize();

        // Calcula as coordenadas reais
        const startCoords = { x: width * startX, y: height * y };
        const endCoords = { x: width * endX, y: height * y };

        // Realiza o swipe
        await driver.touchPerform([
            { action: 'press', options: startCoords },
            { action: 'wait', options: { ms: 1000 } }, // Pode ajustar o tempo conforme necessário
            { action: 'moveTo', options: endCoords },
            { action: 'release', options: {} },
        ]);

        // Verifica se o elemento alvo está visível após o swipe
        const isTargetVisible = await targetElement.isDisplayed();
        assert.isTrue(isTargetVisible, 'O swipe horizontal falhou ou o elemento alvo não está visível após o swipe');
    });

Hi, I had the same problem and found the solution here, it might be helpful for you

@mathewscoelho thanks for reply, but I resolve this problem. The problem was o command performTouch, his not working no WebDriverIo.

Anyway, I used appium gestures plugin for gestures tests and working for me normally.

Code:

it('Should not be able to swipe past carousel', async () => {

        // Elemento alvo para verificar após o swipe

        const targetElement = await $('//android.widget.TextView[@text="GREAT COMMUNITY"]');

        const carousel = await $("~Carousel");

        // Ensure elements are displayed

        await expect(carousel).toBeDisplayed();

        await expect(targetElement).not.toBeDisplayed(); // Ensure the target element is not visible initially

        // Perform a right swipe on Carousel

        await gestures.swipeElement(driver, carousel, 'right', 50);

        // Verifica se o elemento alvo está visível após o swipe

        await expect(targetElement).not.toBeDisplayed();

    })