Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

91
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!