This is my code which testing upload and finds a to , located in my ’s folder. The purpose is code to be run on any machine. is .NET Core:

IWebDriver driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
driver.Manage().Window.Maximize();
driver.Url = "http://demoqa.com/registration/";

IWebElement uploadPic = driver.FindElement(By.Id("profile_pic_10"));
        uploadPic.Click();
driver.SwitchTo().ActiveElement().SendKeys(Path.GetFullPath(@"......avatar.jpg"));
//(@"......avatar.jpg" indicates  path

But the code isn’t working on 3 Project which I prefer. Is there any way to fix it? Is true that this escaping is working only with .NET Core and .NET Framework projects? The error says: “File not found : C:Program Files (x86)avatar.jpg”. I don’t know why it looking in this folder



Source link https://sqa.stackexchange.com/questions/34761/relative-path-to-file-in-nunit-test-project

LEAVE A REPLY

Please enter your comment!
Please enter your name here