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

206
Vistas
Is it possible for testcafe to read a variable from another file?

I want to create some automation so the user would have to place a file with some details like their address and then my automation script would pick it up.

I'm comfortable with using the const command in TestCafe to pick up local variables but is there a way if i put a file in like lets say address.txt for it to pick up line1 line2 line3, etc?

So i see the code like this:

const line1;
const line2;
const line3;

and in Address.txt we'd have

$line1 = '1 hello world way'
$line2 = 'line 2'
$line3= 'line 3'

What am i missing to plug it all together? Thanks,

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can use the native facilities of NodeJS. Please refer to the example from our documentation for more details.

about 4 years ago · Juan Pablo Isaza Denunciar

0

This would be better if done through json. Here is a high level approach you could take:

  1. Keep an excel file to get data from users (say, address).
  2. Use xlsx-to-json to convert excel data to json.
  3. Refer this json in your script: const dataFile = require('./data.json');
  4. Parse json and do whatever is needed.
about 4 years ago · Juan Pablo Isaza Denunciar
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