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

94
Visualizações
WebdriverIO JS how to only run code block if tests are running on Browserstack

I have some code in my hooks that runs while were running tests in Browserstack to update test results etc.

The line of code in question:

global.driver.execute(`browserstack_executor: ${JSON.stringify(result)}`)

The problem with having it running in the hooks is that it'll run even if we're running the tests locally.

This produces the error (which makes sense):

ERROR webdriver: Request failed with status 405 due to unknown method: Method is not implemented

Obviously we don't want this running at all when we're running the tests locally, so I wrapped it in a try catch. The issue is that the error is actually being thrown after the try catch so doesn't actually suppress the error at all.

I want to try and wrap this in an if statement that says "If we're running tests in Browserstack then..." however I'm unsure how to write this, or if anything like this exists at all.

Any help or other suggestions would be appreciated!

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