Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

99
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda