public virtual void SetUp() { RunOnce(); RunConfigurator.RunPath = "resources/run.xml"; RunConfigurator.DownloadPath = downloadPath; RunConfigurator.ResourcesPath = "resources/"; if (_testContext == null) { RunConfigurator.RunPath = "resources/probeRun.xml"; Directory.CreateDirectory(downloadPath); RunConfigurator.DownloadPath = downloadPath; RunConfigurator.ResourcesPath = "resources/"; if (Screen.PrimaryScreen.Bounds.Width != 1920) { ChangeResolutionToFHD(); } } RunConfigurator.ClearDownloads(); User = new UserSteps(); _baseUrl = RunConfigurator.GetValue("baseurl"); GetResolution(); Browser.GetInstance(RunConfigurator.DownloadPath); Browser.GetDriver().Manage().Window.Maximize(); Browser.GetDriver().Navigate().GoToUrl(_baseUrl); }
public static IWebDriver SetupBrowser(string path) { var browserName = RunConfigurator.GetValue("browser"); if (browserName == "chrome") { var options = new ChromeOptions(); options.AddUserProfilePreference("safebrowsing.enabled", true); options.AddUserProfilePreference("download.default_directory", Path.GetFullPath(path)); return(new ChromeDriver(Path.GetFullPath(DriverPath), options)); } if (browserName == "firefox") { var profile = new FirefoxProfile(); profile.SetPreference("browser.helperApps.neverAsk.saveToDisk", "application/octet-stream;application/csv;text/csv;application/vnd.ms-excel;"); return(new FirefoxDriver(profile)); } return(new ChromeDriver(Path.GetFullPath(DriverPath))); }
public Process LaunchPowerShellInstance(string scriptName, string parameters) { ProcessStartInfo processInfo; Process process; //Disabling architechture redirecting var ptr = new IntPtr(); var isWow64FsRedirectionDisabled = Wow64DisableWow64FsRedirection(ref ptr); Debug.WriteLine("Is Wow64Fs Redirection disabled:\t" + isWow64FsRedirectionDisabled); var path = Path.GetFullPath(RunConfigurator.ResourcesPath + scriptName); processInfo = RunConfigurator.GetValue("arc") == "x86" ? new ProcessStartInfo(@"C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe", @"-NoProfile -ExecutionPolicy unrestricted -File """ + path + @"""" + parameters) : new ProcessStartInfo(@"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe", @"-ExecutionPolicy RemoteSigned -File """ + path + @"""" + parameters); processInfo.CreateNoWindow = true; processInfo.UseShellExecute = false; processInfo.RedirectStandardOutput = true; mainProcess = Process.Start(processInfo); return(mainProcess); }