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

207
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
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