While testing protractor integrated in GlobaLeaks with saucelabes and implementing an end to end test for a file uploader i'm getting the following error:
Failed: unknown error: path is not absolute: /home/travis/build/globaleaks/GlobaLeaks/client/tests/glclient/test-globaleaks-process.js
the error seems sketchy 'cause as you can notice the path is an absolute path.
can anybody understand what is probably happening?
the test is runned without issues on Firefox while it is failing on Chrome;
this is the failing build: https://travis-ci.org/globaleaks/GlobaLeaks/jobs/62939365
the code i'm using is:
element(by.xpath("//input[@type='file']")).sendKeys(__filename);
where __filename is the global variabe that would contain always an absolute path pointing to the current file.
@juliemr do you have any hint on this?
The error is coming from Chromedriver - you can search for "path is not absolute" in the logs at https://saucelabs.com/jobs/c7411d5340c94320a29f61cd2f5d76e9
I think this is because your Chrome browser is on a windows computer, so Chromedriver is running on windows. This means that it's expecting a drive name to test if the path is absolute, so /home/travis/... doesn't qualify as an absolute path on windows.
There's been a lot of confusion about file uploading lately. Protractor has deferred to WebDriver's implementation here, but it's clear that we need to do a better job with helpers and docs. I'm going to consolidate under one bug.
thank you @juliemr
so probably this documentation also should be updated.
given what is stated there i was thinking that the path should not change depending on the filesystem and that automatically somewhere there would be some pice of code handling it :)
When running against a remote Selenium server, a webdriver.FileDetector may be used to transparently copy files to the remote machine before attempting to upload them in the browse
let me say that what you suggest about windoes is not correct; this behaviour happend also on linux/mac: https://saucelabs.com/u/globaleaks
as we (protractor user) would be interested simply in using this capability for testing it would be great to find an alternative way to load a file testing a file uploader button without requiring a file to be present on the filesystem. e.g. something like usin a Blob or a data:// uri. do you know if something like this is possible?
I really think it's due to windows. If you look at https://saucelabs.com/tests/b6b818a388b84c06ba4f907ab9a0a08d, which runs on Linux it is NOT failing with the 'path is not absolute' error.
gotcha! you are right, i didn't noticed it.
so to solve the issue we should find out a proper way to document in order to write a piece of code usable for all the OS without failures.
Yup. I'm closing this, let's follow up in #2153
same problem to me.
Then, how to solve it ?
I still have this problem. Is there a better fix/documentation for uploading files yet?
Still have the problem with selenium 3.0.1 and protractor 4.0.14. Any chance to have this feature working ?
Also hitting this as of late, but am running 4.0.14 as well (@jmcollin78). The chain of linked and referenced threads is not exactly straightforward on the case of linux->windows tests.
Is the best option here if we're running a windows selenium node to drop the file on that machine and refer to the path of the file with a windows path? I've been autogenerating them in the suite (unique new pem/cert), so that's a little less than ideal. Otherwise I guess setting up a linux hub/node is the only alternative (I want to avoid running an instance on the CI machine doing the deploy/test run)?
Most helpful comment
I still have this problem. Is there a better fix/documentation for uploading files yet?