1

I'm experiencing some problems using karate testing when uploading a file through a web interface using a Selenium grid cluster (Zalenium) and Jenkins:

  1. find an easy way for getting the full path of the file to be able to send it to the input web element with:

    waitFor(inputFieldSelector).input(fullPathOfThefile)

    I solved this using a custom java method to reconstruct it but for sure there's a faster/more elegant way. Is there a specific Karate function/way for get it?

  2. find a way to set up the remote webdriver to handle the local files as it seems that it searches the file to upload in the wrong place.

    In Java I solved it using setFileDetector of RemoteWebDriver with LocalFileDetector (an example is shown below) but I don't know how to do it in Karate:

    RemoteWebDriver rwd = new RemoteWebDriver(new URL(gridUrl), DesiredCapabilities.firefox());
    rwd.setFileDetector(new LocalFileDetector());
    
0

1 Answer 1

1

This may need investigation, to be honest we haven't worked on file-uploads to that extent, so we may need your help. For point 1, a custom Java method sounds good to me but you can suggest a new API and we can add it to Karate in the next version, maybe karate.toAbsolutePath('classpath:some/file.txt')

Any reference you can point us to for the FileDetector will help - it would be great if you can contribute code. At the very least, please consider submitting a sample in this form: https://github.com/intuit/karate/tree/develop/examples/ui-test

1
  • 1
    I'll try to make some example in ui-test. I think that anyway, even if the usage of absolute path is discouraged, that method could be useful in particular situation like the one I mentioned. Commented Mar 15, 2020 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.