Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/320.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
Java 如何使用xpath作为sendkeys从selenium上传只读文本文件;行不通_Java_Html_Angularjs_Selenium_File Upload - Fatal编程技术网

Java 如何使用xpath作为sendkeys从selenium上传只读文本文件;行不通

Java 如何使用xpath作为sendkeys从selenium上传只读文本文件;行不通,java,html,angularjs,selenium,file-upload,Java,Html,Angularjs,Selenium,File Upload,结构如下: 我使用下面的代码上传文件,但sendkeys不工作,我没有收到任何错误,但无法上传 WebElement uploadingEmote = adminDriver.findElement(By.xpath("//input[@placeholder='Upload Emote']")); uploadingEmote.sendKeys("/home/smart/Downloads/EMO/(Heart).png"); 但是上

结构如下:

我使用下面的代码上传文件,但sendkeys不工作,我没有收到任何错误,但无法上传

    WebElement uploadingEmote = adminDriver.findElement(By.xpath("//input[@placeholder='Upload Emote']"));
    uploadingEmote.sendKeys("/home/smart/Downloads/EMO/(Heart).png");
但是上面的代码不起作用,因为字段是只读的。 任何帮助都将不胜感激


如果要上载文件,输入字段的类型应为“文件”类型

<input type="file" name="fileToUpload" id="fileToUpload">

您所说的代码不起作用到底是什么意思?你看到什么错误了吗?更新问题
<input type="file" name="fileToUpload" id="fileToUpload">