Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

98
Visualizações
WebdriverIO error when adding capabilities to edgeOptions in beforeSession hook

I'm currently trying to add mobileEmulation capabilities into ms:edgeOptions through my beforeSession hook when specific spec is being run. Framework is using wdio v7.9.

When adding mobileEmulation:{'deviceName': 'iPhone X'} into the capabilities at the top of wdio.conf this works without issue.

The issue occurs during the hook, which is where I need this as I only need it to run for this specific spec and not the rest of the suite.

beforeSession Hook:

if(capabilities.browserName === 'MicrosoftEdge' && specs.toString() === '[PathToSpecFile]'){
            capabilities['ms:edgeOptions'].mobileEmulation = 'iPhone X';
            console.log('##########', capabilities);
        }

The console output shows the capabilities have been set as expected:

    ########## {
[0-0]   maxInstances: 1,
[0-0]   browserName: 'MicrosoftEdge',
[0-0]   'ms:edgeOptions': {
[0-0]     args: [],
[0-0]     prefs: {
[0-0]       'download.default_directory': '[PATH]'
[0-0]     },
[0-0]     mobileEmulation: 'iPhone X'
[0-0]   },
[0-0]   protocol: 'http',
[0-0]   hostname: 'localhost',
[0-0]   port: 4444,
[0-0]   path: '/wd/hub'
[0-0] }

However when attempting to create the session I'm getting the following error output:

ERROR webdriver: Request failed with status 500 due to session not created: Unable to create session from {
[0-0]   "desiredCapabilities": {
[0-0]     "browserName": "MicrosoftEdge",
[0-0]     "ms:edgeOptions": {
[0-0]       "args": [
[0-0]       ],
[0-0]       "prefs": {
[0-0]         "download.default_directory": "[PATH]"
[0-0]       },
[0-0]       "mobileEmulation": "iPhone X"
[0-0]     }
[0-0]   },
[0-0]   "capabilities": {
[0-0]     "firstMatch": [
[0-0]       {
[0-0]         "browserName": "MicrosoftEdge",
[0-0]         "ms:edgeOptions": {
[0-0]           "args": [
[0-0]           ],
[0-0]           "prefs": {
[0-0]             "download.default_directory": "[PATH]"
[0-0]           },
[0-0]           "mobileEmulation": "iPhone X"
[0-0]         }
[0-0]       }
[0-0]     ]
[0-0]   }
[0-0] }
[0-0] Driver info: driver.version: unknown
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda