w3c / webdriver

Remote control interface that enables introspection and control of user agents.
https://w3c.github.io/webdriver/
Other
676 stars 190 forks source link

Error 405 when trying to run a simple swipe test #1770

Closed LeohsPaixao closed 7 months ago

LeohsPaixao commented 7 months ago

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:

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');
    });
whimboo commented 7 months ago

Dear @LeohsPaixao. This repository is basically for the spec work and not around issues with webdriver clients. If there is such an issue please use the webdriver client's issue tracker.

Otherwise please note that /session/<id>/touch/perform is not a valid WebDriver classic command. Touch actions are routed through Perform Actions as well.