Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 使用Nightwatch和浏览器堆栈/Selenium网格上载文件_Node.js_Browserstack_Nightwatch - Fatal编程技术网

Node.js 使用Nightwatch和浏览器堆栈/Selenium网格上载文件

Node.js 使用Nightwatch和浏览器堆栈/Selenium网格上载文件,node.js,browserstack,nightwatch,Node.js,Browserstack,Nightwatch,我正试图在IE11的Browserstack上运行的夜视测试中上传一个文件。以下是我所拥有的: browser.execute(function (data) { const el = document.querySelector('input#fileUpload'); el.style.display = "block"; el.removeAttribute('multiple'); }, []); browser.setValue('input#fileUpload', r

我正试图在IE11的Browserstack上运行的夜视测试中上传一个文件。以下是我所拥有的:

browser.execute(function (data) {
  const el = document.querySelector('input#fileUpload');
  el.style.display = "block";
  el.removeAttribute('multiple');
}, []);

browser.setValue('input#fileUpload', require('path').resolve(__dirname + '/upload-files/test-doc.pdf'))

该错误是一个文件未找到的问题,在Chrome本地运行时工作正常。四处搜索,似乎我需要先将文件上载到BS,我找到了这个和这个,但都不适用于我。

由于BrowserStack的机器上不存在该文件,您可能会遇到此错误。您需要使用Selenium提供的“setFileDetector”方法将本地文件上载到远程网格。更多详细信息可以在他们的文档中找到-

是的,我也读过,但我不确定这如何转化为nightwatch,它似乎没有直接暴露由该代码导入的底层驱动程序。@ben有关于这个问题的新发现吗?你修好了吗?