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

90
Visualizações
Karate UI Automation - driver.inputFile not working with ChromeWebDriver

I am working on an automation project that requires a file upload using Karate UI. Me and my team tried a few alternatives and using driver.inputFile() seemed to work just fine. However, we also run tests on headless mode with Browserstack, where we noticed the same line would not work, giving the following error:

js failed:
>>>>
01: driver.inputFile(cleoPortal.inputBox, "C:\\Users\\hello\\Documents\\documents\\text-sample1.txt")
<<<<
org.graalvm.polyglot.PolyglotException: TypeError: invokeMember (inputFile) on com.intuit.karate.driver.chrome.ChromeWebDriver@4cfcac13 failed due to: Unknown identifier: inputFile
- <js>.:program(Unnamed:1)

After looking at the trace, it looks to me that, for some reason, when running headless, the driver does not have this method defined. When investigating, I also confirmed that the 2 ways of running initialize different driver objects, com.intuit.karate.driver.chrome.Chrome for the local run and com.intuit.karate.driver.chrome.ChromeWebDriver for the headless.

Headless: Headless run report img

Local: Local run report img

After digging a little into the karate source code, I found that ChromeWebDriver.java extends the WebDriver class, while Chrome.java extends DevToolsDriver, and that the former does not have the method inputFile() that we're trying to use.

Considering this, my question is: Would it be possible to implement this method in WebDriver? Or are there any alternatives we can try? I would also like to point out that I tried regular input() but it didn't work.

I did not setup any demo project since I am not really sure how to reproduce the issue without heavy configuration and the aid of other tools, but I'm open to suggestions in case it helps solving the problem. Sorry about that!

Thanks in advance for the help!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

That is correct, WebDriver and the Chrome DevTools (which we recommend) are fundamentally different. The last time I checked, file-upload was a known limitation in the WebDriver spec and each browser driver (Firefox, Safari etc.) does not support or has different behavior.

And yes headless browsers have limitations as well.

So my advice is to change your testing strategy so that file-upload is tested only on one browser. Also refer: https://stackoverflow.com/a/61393515/143475

But you are welcome to do some research and contribute code to the Karate project. We will be happy to accept any PR that improves the state of things.

In case Playwright supports cross-browser file-upload that is also an option to investigate, since we have an experimental adapter.

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