简体   繁体   English

上载存储在Internet上的文件-“路径不是绝对的”错误

[英]Uploading a file that is stored on the internet - “path is not absolute” error

I have a Selenium test running with ChromeDriver, that uploads a video file by using SendKeys to provide a path to the file element, circumventing the dialog box. 我有一个运行ChromeDriver的Selenium测试,该测试通过使用SendKeys提供文件元素的路径来上载视频文件,从而绕开了对话框。

Driver.FindElement(By.Id("videoFile")).SendKeys("C:\src\TestFiles\testvideo.mp4");

I'm in the process of moving our build boxes to the cloud to save time/money/effort, but this means that using locally-stored files is no longer sustainable, so I've moved them to a website. 我正在将构建箱移至云中以节省时间/金钱/精力,但这意味着使用本地存储的文件不再可持续,因此我将其移至网站。

I've tried to replace the local path with the full http path, but am getting the below error 我试图用完整的http路径替换本地路径,但出现以下错误

error: unknown error: path is not absolute: https://example.cloudfront.net/999/testvideo.mp4

This process works when I do it manually through the dialog box, so I'm not sure what I'm missing. 当我通过对话框手动执行此过程时,此过程将起作用,因此我不确定所缺少的内容。

Any help would be greatly appreciated. 任何帮助将不胜感激。

Try 尝试

Driver.FindElement(By.Id("videoFile")).SendKeys(@"string filepath");

@ marks the string as a verbatim string literal - anything in the string that would normally be interpreted as an escape sequence is ignored. @将字符串标记为原义字符串文字-字符串中通常被解释为转义序列的任何内容都将被忽略。

See this 看到这个 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM