From e31a453eaf71bd5af96ecc46f7d83f8f0be1a9e6 Mon Sep 17 00:00:00 2001 From: Ivan Krutov Date: Wed, 31 Oct 2018 10:43:30 +0300 Subject: [PATCH] Added webdriver.io example to file upload section --- docs/file-upload.adoc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/file-upload.adoc b/docs/file-upload.adoc index b04ce2ab..3dd9d5f8 100644 --- a/docs/file-upload.adoc +++ b/docs/file-upload.adoc @@ -31,6 +31,14 @@ driver.file_detector = LocalFileDetector() input.send_keys("/path/to/file/on/machine/which/runs/tests") ---- +.Uploading files with Webdriver.io +[source,javascript] +---- +var filePath = path.join('/path/to/file/on/machine/which/runs/tests'); +browser.uploadFile(filePath); +browser.chooseFile("input[type='file']", filePath); +---- + Read the following note if you are using Selenoid **without Docker**. NOTE: This feature is supported in WebDriver protocol by sending zipped file contents to `/file` handle. However not all driver binaries support this feature. For example this is not implemented in http://github.com/mozilla/geckodriver[Geckodriver] or https://github.com/SeleniumHQ/selenium/tree/master/cpp/iedriver[IEDriver]. When proxying requests **directly** to these drivers (i.e. when **not using Docker**) you need to start Selenoid with `-enable-file-upload` flag. In that case Selenoid will provide required API to tests. Firefox container images already include this parameter where needed. \ No newline at end of file