Reputation: 143
I am having trouble uploading a jpg file into a Drupal form, and cannot work out why, or how best to debug it. My code appears to confirm the file is there, but NightwatchJS disagrees.
The snippets of code around this look like:
let path = require("path").resolve(__dirname + '/../../../../../../../modules/custom/test_folder/assets/image.jpg');
console.log(path);
console.log('** test: ', fs.existsSync(path))
.uploadFile('.form-managed-file__main input[type="file"]', require('path').resolve(path))
// .setValue('.form-managed-file__main input[type="file"]', require('path').resolve(path))
Both of these return similar errors
Error Error while running .uploadFile() protocol action: invalid argument: File not found : unknown command: session/7c893475ca097b82470f980a18c87ab8/se/file
(Session info: headless chrome=106.0.5249.103) (Driver info: chromedriver=106.0.5249.61 (511755355844955cd3e264779baf0dd38212a4d0-refs/branch-heads/5249@{#569}),platform=Linux 6.5.0-27-generic x86_64)
TimeoutError An error occurred while running .uploadFile() command on <.form-managed-file__main input[type="file"]>: invalid argument: File not found : unknown command: session/7c893475ca097b82470f980a18c87ab8/se/file (Session info: headless chrome=106.0.5249.103) (Driver info: chromedriver=106.0.5249.61 (511755355844955cd3e264779baf0dd38212a4d0-refs/branch-heads/5249@{#569}),platform=Linux 6.5.0-27-generic x86_64)
Is there anything special I need to do to get to work in Docker? Or maybe just some steps to debug, as existsSync
says the file is there (returns true), but nightwatch says it isn't. I have gone through forum posts, but most comments are quite old, and also don't appear to help resolve this.
Thanks for any tips, Dan
Upvotes: 0
Views: 26