CodeceptJS icon indicating copy to clipboard operation
CodeceptJS copied to clipboard

The function fillField is not working, i need another alternative to fill the field

Open GzSphynx opened this issue 3 years ago • 0 comments

What are you trying to achieve?

I am tryng to do a login scenario, but everytime i tried to use the type function in codeceptjs i got the error. OBS: i've tried use fillField funciton but after fill the field the button is not enable.

What do you get instead?

2022-07-31T14:09:08.666Z ERROR webdriver: Request failed with status 404 due to unknown command: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource

Provide console output if related. Use --verbose mode for more details.

Login --
    [1]  Starting recording promises
    Timeouts:
  Login com sucesso
    start_page: clicarNoBotaoComecarAgora 
      I tap "#br.com.vivo:id/start_now"
    identifique_page: fazerLogin "45829304848", "106338"
      I wait for element "#tabCpf", 5
      I tap "#tabCpf"
      I wait for element "#cpf", 5
      I tap "#cpf"
      I type "45829304848"
2022-08-01T14:35:12.627Z ERROR webdriver: Request failed with status 404 due to unknown command: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
    [1] Error | unknown command: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
    [1] Error | unknown command: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
    [1] Error | unknown command: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
    [1] Error | unknown command: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
    [1] Error | unknown command: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
    [1] Error | unknown command: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
    [1] Error | unknown command: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
    [1] Error | unknown command: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
    [1] Error | unknown command: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
    [1] <teardown> Stopping recording promises
 » <screenshotOnFail> Test failed, try to save a screenshot
 » Screenshot has been saved to C:\Users\felip\OneDrive\Documentos\AppVivo\output\Login_com_sucesso.failed.png
  × FAILED in 7201ms

    [2]  Starting recording promises

-- FAILURES:

  1) Login
       Login com sucesso:
     The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource
      at getErrorFromResponseBody (node_modules\webdriver\build\utils.js:198:12)
      at NodeJSRequest._request (node_modules\webdriver\build\request\index.js:166:60)
      at processTicksAndRejections (node:internal/process/task_queues:96:5)
      at async Browser.wrapCommandFn (node_modules\@wdio\utils\build\shim.js:137:29)
      at async Browser.wrapCommandFn (node_modules\@wdio\utils\build\shim.js:137:29)
      at async Appium.type (node_modules\codeceptjs\lib\helper\WebDriver.js:1895:5)

  Scenario Steps:
  - I.type("45829304848") at Object.fazerLogin (.\pages\identifique_page.js:28:7)
  - I.tap("#cpf") at Object.fazerLogin (.\pages\identifique_page.js:25:7)
  - I.waitForElement("#cpf", 5) at Object.fazerLogin (.\pages\identifique_page.js:24:7)
  - I.tap("#tabCpf") at Object.fazerLogin (.\pages\identifique_page.js:22:7)
  - I.waitForElement("#tabCpf", 5) at Object.fazerLogin (.\pages\identifique_page.js:21:7)
  - I.tap("#br.com.vivo:id/start_now") at Object.clicarNoBotaoComecarAgora (.\pages\start_page.js:10:7)

  Artifacts:
  - screenshot: C:\Users\felip\OneDrive\Documentos\AppVivo\output\Login_com_sucesso.failed.png

  FAIL  | 0 passed, 1 failed   // 18s

Provide test source code if related

const { I } = inject();

module.exports = {

  tabs:{
    CPFouEmail: "#tabCpf"
  },

  campos:{
    cpf: "#cpf",
    senha: "#senha"
  },

  botao:{
    continuar: "//android.widget.Button[@text='Continuar']"
  },

 
  fazerLogin(CPF, senha){
    I.waitForElement(this.tabs.CPFouEmail,5)
    I.tap(this.tabs.CPFouEmail)

    I.waitForElement(this.campos.cpf,5)
    I.tap(this.campos.cpf)
    //I.fillField(this.campos.cpf, CPF)
    I.type(CPF)
    
    I.waitForElement(this.botao.continuar,5)
    I.tap(this.botao.continuar)

    I.waitForElement(this.campos.senha,5)
    I.tap(this.campos.senha)
    //I.fillField(this.campos.senha, senha)
    I.type(senha)

    I.waitForElement(this.botao.continuar,5)
    I.tap(this.botao.continuar)
  }
}

Details

  • CodeceptJS version: "3.3.4"
  • NodeJS Version: 8.14.0
  • Operating System: Windowns
  • webdriverio
  • Configuration file: codecept.conf
const { setHeadlessWhen, setCommonPlugins } = require('@codeceptjs/configure');

// turn on headless mode when running with HEADLESS=true environment variable
// export HEADLESS=true && npx codeceptjs run
setHeadlessWhen(process.env.HEADLESS);

// enable all common plugins https://github.com/codeceptjs/configure#setcommonplugins
setCommonPlugins();

exports.config = {
  tests: './*_test.js',
  output: './output',
  helpers: {
    Appium: {
      platform: 'android',
      desiredCapabilities: {
        appPackage: 'br.com.vivo',
        appActivity: 'br.com.vivo.MainActivity',
        deviceName: 'emulator-5554',
        platformVersion: '12',
        noReset: "false",
        automationName: "UiAutomator2",
        resetKeyboard: "true",
        unicodeKeyboard: "true",
        autoGrantPermissions: "true"
      }
    }
  },
  include: {
    I: './steps_file.js',
    start_page: './pages/start_page.js',
    identifique_page: './pages/identifique_page.js',
    descubraPage: './pages/descubra_page.js',
  },
  bootstrap: null,
  mocha: {},
  name: 'AppVivo'
}

GzSphynx avatar Jul 28 '22 03:07 GzSphynx