1

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.

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

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.

stuartjay
  • 47
  • 1
  • 1
  • 6

1 Answers1

1

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 enter image description here

Community
  • 1
  • 1
Saifur
  • 16,081
  • 6
  • 49
  • 73