Create a folder in your solution and add the files.
add the below GetBasePath method. There are a variety of ways you can do this.
ex: Create a folder called "Files" and add "test.mp4" to it in your solution.
Step:
And I can upload image test.mp4
Feature:
[When(@"I can upload image (.*) ")]
public void WhenICanUploadImage(string value)
{
var path = GetBasePath;
string filePath = string.Format(path + @"\Files\{0}", value);
FindElement_byXPath("//div[@class='myClass']//input[@class='input']").SendKeys(filePath);
}
GetBasePath function is great because if you run local on D: and Jenkins is running on E: drive, no changes are required. Debug the above and then adjust the path from there depending on where you added the Files folder.
public static string GetBasePath
{
get
{
var basePath =
System.IO.Path.GetDirectoryName((System.Reflection.Assembly.GetExecutingAssembly().Location));
basePath = basePath.Substring(0, basePath.Length - 10);
return basePath;
}
}