linux - Linux 本地文件系统中格式错误的 url 异常

标签 linux selenium malformedurlexception

我一直在尝试执行 selenium.attachFile 命令来上传文件-

sel.attachFile(dom_locator,"/home/xyz/Desktop/tstfl.txt");

但指定的文件路径出现格式错误的 URL 异常。该文件存在于 Linux 本地文件系统中。请帮助我确定文件路径的正确格式。

最佳答案

您可能需要的是

sel.attachFile(dom_locator,"file:///home/xyz/Desktop/tstfl.txt");

有关文件 uri 的说明,请参阅 File URI scheme在维基百科中。

关于linux - Linux 本地文件系统中格式错误的 url 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6623863/

相关文章:

node.js - 使用webdriver node.js端到端测试/运行Selenium IDE .json文件

java - 克服 java.net.MalformedURLException : no protocol Exception

c - 我什么时候应该提供 #defined 宏来在 Linux 内核中声明或初始化变量?

linux - 如何将正则表达式表示的文件列表输入给 bash 脚本

linux - linux环境下jmeter中如何获取OS Process sampler

java - 如何等到没有带有属性ready_to_send的span标签,或者换句话说,没有带有send属性的span标签

linux - 如何解决 Linux 构建过程中 *** 所需的错误 "make[1]: *** No rule to make target ` init/main.o'?

java - 断言失败后如何不停止执行?

Java 异常,将数据从 try block 传递到处理程序

python - 如何在 Python 中验证 url? (格式不正确)