-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
File upload is not working when using Web driver when running test on Sauce Lab or Remote Grid #2541
Comments
tagging this as help wanted. personally I feel workarounds are fine, refer: https://stackoverflow.com/a/61393515/143475 |
Thanks @ptrthomas for the response. The problem with Robot workaround is, it only works if file exists on the host where tests are executing. We execute our test suite on Saucelab from the pipeline. Currently as a workaround, we are using RemoteWebDriver's hidden API to post attachement to the remote host and then upload file from remote host location. I did cloned Karate code today and was able to make file upload working for both WebDriver and DevToolsDriver. |
@djasani yes if you can submit a PR, that would be the best option |
@ptrthomas After finishing my implementation I realized that you have already implemented this feature for DevToolsDriver. It's has been implemented in the method "inputFile". I did not find similar method for WebDriver and PlaywrightDriver so I will implement and create PR after that. Somehow I am not able to run using PlaywrightDriver from Karate-Core. It opens Chromium but just keeps waiting after WebSocket connection is established. However I am able to make it work for Playwright Driver in Karate-Playwright module. |
@ptrthomas I have executed LocalParallelRunner, PlaywrightRunner and LocalSingleRunner (chromedriver) after my changes. Previously we were only performing file upload when browserType was only Chrome. I have commented following line in the feature file 08.feature so file upload occurs for all different browserType.
I also had to refactor 09.feature file to make this run in playwright. I believe playwright is handling frames differently. Please find attached here are the results for karate-e2e-tests |
@djasani thanks ! I'm a little extra busy at the moment so will request if @f-delahaye can take a look |
@ptrthomas Will do. |
We can use input method on file input element and set file path as value. This approach works fine If you are running browser locally as it can find the file but when running same tests it does not work.
This is done in Selenium Web Driver using http Rest call. We can use similar implementation on Karate side to support this feature.
We can have something like,
driver.upload(input element, filePath) and implemented this.
I am able to make this work using workaround but this will be great if file upload on remote execution host is supported out of the box in Karate framework
The text was updated successfully, but these errors were encountered: